Go to the documentation of this file.
9 #ifndef EAGINE_MESSAGE_BUS_SERVICE_DISCOVERY_HPP
10 #define EAGINE_MESSAGE_BUS_SERVICE_DISCOVERY_HPP
12 #include "../serialize.hpp"
13 #include "../subscriber.hpp"
17 struct subscriber_info {
22 template <
typename Base = subscriber>
23 class subscriber_discovery :
public Base {
24 using This = subscriber_discovery;
32 this,
EAGINE_MSG_MAP(eagiMsgBus, stillAlive, This, _handle_alive));
38 EAGINE_MSG_MAP(eagiMsgBus, unsubFrom, This, _handle_unsubscribed));
41 EAGINE_MSG_MAP(eagiMsgBus, notSubTo, This, _handle_not_subscribed));
45 virtual void is_alive(
const subscriber_info&) = 0;
46 virtual void on_subscribed(
const subscriber_info&, message_id) = 0;
47 virtual void on_unsubscribed(
const subscriber_info&, message_id) = 0;
48 virtual void not_subscribed(
const subscriber_info&, message_id) = 0;
51 auto _handle_alive(
const message_context&, stored_message& message)
53 subscriber_info
info{};
60 auto _handle_subscribed(
const message_context&, stored_message& message)
64 subscriber_info
info{};
67 on_subscribed(info, sub_msg_id);
72 auto _handle_unsubscribed(
const message_context&, stored_message& message)
76 subscriber_info
info{};
79 on_unsubscribed(info, sub_msg_id);
84 auto _handle_not_subscribed(
const message_context&, stored_message& message)
88 subscriber_info
info{};
91 not_subscribed(info, sub_msg_id);
99 #endif // EAGINE_MESSAGE_BUS_SERVICE_DISCOVERY_HPP
#define EAGINE_MSG_MAP(CLASS_ID, METHOD_ID, CLASS, METHOD)
Constructs an instance of static message handler map.
Definition: handler_map.hpp:72
@ info
Informational log entries.
std::uint32_t process_instance_id_t
Unique process identifier type (does not necessarily match to OS PID).
Definition: identifier_t.hpp:22
Message bus code is placed in this namespace.
Definition: eagine.hpp:58
@ message
Message protocol.
@ instance_id
The endpoint instance id has changed.
std::uint64_t identifier_t
The underlying integer type for eagine::identifier.
Definition: identifier_t.hpp:19
auto default_deserialize_message_type(message_id &msg_id, memory::const_block blk)
Default-deserializes the specified message id from a memory block.
Definition: serialize.hpp:266
@ message_id
The message type id has been verified.