Go to the documentation of this file.
9 #ifndef EAGINE_MESSAGE_BUS_SERVICE_HPP
10 #define EAGINE_MESSAGE_BUS_SERVICE_HPP
12 #include "../bool_aggregate.hpp"
23 template <
typename Base = subscriber>
41 : Base{
static_cast<Base&&
>(that)} {
61 return this->
bus().add_connection(std::move(conn));
67 something_done(this->
update());
69 return something_done;
84 auto _handle_sup_query(
const message_context&, stored_message& message)
90 auto _handle_sub_query(
const message_context&, stored_message& message)
92 message_id sub_msg_id{};
106 template <
typename Signature, std::size_t MaxDataSize = 8192 - 128>
107 using default_callback_invoker = callback_invoker<
115 template <
typename Signature, std::size_t MaxDataSize = 8192 - 128>
116 using default_invoker = invoker<
124 template <
typename Signature, std::size_t MaxDataSize = 8192 - 128>
125 using default_skeleton = skeleton<
133 template <
typename Signature, std::size_t MaxDataSize = 8192 - 128>
134 using default_function_skeleton = function_skeleton<
142 template <
typename Signature, std::size_t MaxDataSize = 8192 - 128>
143 using default_lazy_skeleton = lazy_skeleton<
151 template <
typename Signature, std::size_t MaxDataSize = 8192 - 128>
152 using default_async_skeleton = async_skeleton<
162 #endif // EAGINE_MESSAGE_BUS_SERVICE_HPP
void announce_subscriptions() const
Sends messages to the bus saying which messages this can handle.
Definition: subscriber.hpp:438
void respond_to_subscription_query(identifier_t source_id) const noexcept
Sends messages responding to a subscription query.
Definition: subscriber.hpp:461
auto operator=(service_composition &&)=delete
Not move assignable.
#define EAGINE_MSG_MAP(CLASS_ID, METHOD_ID, CLASS, METHOD)
Constructs an instance of static message handler map.
Definition: handler_map.hpp:72
auto update() const noexcept -> bool
Updates the internal endpoint state (should be called repeatedly).
Definition: subscriber.hpp:51
service_composition(endpoint &bus)
Construction from a reference to an endpoint.
Definition: service.hpp:33
service_composition(service_composition &&that)
Move constructible.
Definition: service.hpp:40
Interface for classes that can use message bus connections.
Definition: connection.hpp:155
Class storing initially false value and logically or-ing other values.
Definition: bool_aggregate.hpp:16
string_deserializer_backend default_deserializer_backend
Alias for default deserialization backend for bus messages.
Definition: serialize.hpp:41
void retract_subscriptions() const noexcept
Sends messages to the bus saying which messages this cannot handle.
Definition: subscriber.hpp:454
Message bus code is placed in this namespace.
Definition: eagine.hpp:58
string_serializer_backend default_serializer_backend
Alias for default serialization backend for bus messages.
Definition: serialize.hpp:36
@ message
Message protocol.
Message bus client endpoint that can send and receive messages.
Definition: endpoint.hpp:30
auto process_all() -> span_size_t
Handles (and removes) all poending received messages.
Definition: subscriber.hpp:430
Helper mixin class for message bus services composed of several parts.
Definition: service.hpp:24
auto add_connection(std::unique_ptr< connection > conn) -> bool final
Adds a connection to the associated endpoint.
Definition: service.hpp:60
auto bus() noexcept -> auto &
Returns a reference to the associated endpoint.
Definition: subscriber.hpp:38
auto update_and_process_all() -> bool final
Updates the associated endpoint and processes all incoming messages.
Definition: service.hpp:65
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
Interface for message bus services.
Definition: service_interface.hpp:19