Network System 0.1.1
High-performance modular networking library for scalable client-server applications
Loading...
Searching...
No Matches
messaging_bridge.h
Go to the documentation of this file.
1// BSD 3-Clause License
2// Copyright (c) 2024, 🍀☀🌕🌥 🌊
3// See the LICENSE file in the project root for full license information.
4
5#pragma once
6#ifndef KCENON_NETWORK_INTERNAL_INTEGRATION_MESSAGING_BRIDGE_H_
7#define KCENON_NETWORK_INTERNAL_INTEGRATION_MESSAGING_BRIDGE_H_
8
25
26#if KCENON_WITH_CONTAINER_SYSTEM
27#include "container.h"
28#endif
29
30#if KCENON_WITH_THREAD_SYSTEM
31// Suppress deprecation warnings from thread_system headers
32# pragma clang diagnostic push
33# pragma clang diagnostic ignored "-Wdeprecated-declarations"
34// Include format for thread_system headers that use std::format
35# include <format>
36#include <kcenon/thread/core/thread_pool.h>
37# pragma clang diagnostic pop
38#endif
39
41
42#include <memory>
43#include <string>
44#include <functional>
45#include <chrono>
46
48
68public:
73
79 ~messaging_bridge() override;
80
81 // INetworkBridge interface implementation
82
109 VoidResult initialize(const BridgeConfig& config) override;
110
118 VoidResult shutdown() override;
119
124 bool is_initialized() const override;
125
140 BridgeMetrics get_metrics() const override;
141
142 // messaging_bridge-specific methods (maintained for backward compatibility)
143
149 std::shared_ptr<kcenon::network::core::messaging_server> create_server(
150 const std::string& server_id
151 );
152
158 std::shared_ptr<kcenon::network::core::messaging_client> create_client(
159 const std::string& client_id
160 );
161
162#if KCENON_WITH_CONTAINER_SYSTEM
167 void set_container(
168 std::shared_ptr<container_module::value_container> container
169 );
170
175 void set_container_message_handler(
176 std::function<void(const container_module::value_container&)> handler
177 );
178#endif
179
180#if KCENON_WITH_THREAD_SYSTEM
185 void set_thread_pool(
186 std::shared_ptr<kcenon::thread::thread_pool> pool
187 );
188#endif
189
195 std::shared_ptr<thread_pool_interface> pool
196 );
197
202 std::shared_ptr<thread_pool_interface> get_thread_pool_interface() const;
203
207 void reset_metrics();
208
209private:
210 class impl;
211 std::unique_ptr<impl> pimpl_;
212};
213
214// Namespace alias for backward compatibility
216
217} // namespace kcenon::network::integration
218
219// Additional backward compatibility aliases
226
227#endif // KCENON_NETWORK_INTERNAL_INTEGRATION_MESSAGING_BRIDGE_H_
Unified interface for external system integration bridges.
A basic TCP client that connects to a remote host, sends/receives data using asynchronous operations,...
Definition tcp.cppm:84
A server class that manages incoming TCP connections, creating messaging_session instances for each a...
Definition tcp.cppm:237
Abstract interface for external system integration bridges.
Bridge class for messaging_system compatibility implementing INetworkBridge.
BridgeMetrics get_metrics() const override
Get current metrics.
bool is_initialized() const override
Check if the bridge is initialized.
std::shared_ptr< kcenon::network::core::messaging_client > create_client(const std::string &client_id)
Create a messaging client with messaging_system compatible API.
std::shared_ptr< kcenon::network::core::messaging_server > create_server(const std::string &server_id)
Create a messaging server with messaging_system compatible API.
void set_thread_pool_interface(std::shared_ptr< thread_pool_interface > pool)
Set thread pool using the integration interface.
void reset_metrics()
Reset performance metrics.
VoidResult shutdown() override
Shutdown the bridge.
std::shared_ptr< thread_pool_interface > get_thread_pool_interface() const
Get the thread pool interface.
Manages a single connected client session on the server side, providing asynchronous read/write opera...
Feature flags for network_system.
tracing_config config
Definition exporters.cpp:29
TCP client implementation.
TCP server implementation.
VoidResult initialize()
Initialize the network system with default production configuration.
Configuration for bridge initialization.
Metrics and health information for a bridge.
Thread system integration interface for network_system.