1 #ifndef RECODEX_BROKER_REACTOR_H 2 #define RECODEX_BROKER_REACTOR_H 9 #include "handler_interface.h" 10 #include "message_container.h" 11 #include "socket_wrapper_base.h" 62 zmq::socket_t &async_handler_socket,
64 std::shared_ptr<handler_interface> handler);
83 static const std::string TERMINATE_MSG;
88 zmq::context_t &context_;
94 zmq::socket_t &reactor_socket_;
105 void handler_thread();
115 const std::string unique_id_;
139 reactor(std::shared_ptr<zmq::context_t> context);
146 void add_socket(
const std::string &name, std::shared_ptr<socket_wrapper_base> socket);
154 void add_handler(
const std::vector<std::string> &origins, std::shared_ptr<handler_interface> handler);
162 void add_async_handler(
const std::vector<std::string> &origins, std::shared_ptr<handler_interface> handler);
198 std::map<std::string, std::shared_ptr<socket_wrapper_base>> sockets_;
203 std::multimap<std::string, std::shared_ptr<handler_wrapper>> handlers_;
208 std::shared_ptr<zmq::context_t> context_;
213 zmq::socket_t async_handler_socket_;
218 std::atomic<bool> termination_flag_;
221 #endif // RECODEX_BROKER_REACTOR_H virtual void operator()(const message_container &message)
std::shared_ptr< handler_interface > handler_
handler_wrapper(reactor &reactor_ref, std::shared_ptr< handler_interface > handler)
virtual ~handler_wrapper()
const std::string unique_id
static const std::string KEY_TIMER