15#include "DestinationTransport.hpp"
16#include <dfx-utilities/sync-queues/SpscFixedQueue.hpp>
40 void stop() noexcept
override {}
48 {
return _pendingMessages.tryPush(std::move(message)); }
52 {
return static_cast<int64_t
>(_pendingMessages.size()); }
58 std::optional<MessagePtr>
pop()
59 {
return _pendingMessages.tryPop(); }
DestinationTransport(Endpoint endpoint, nlohmann::json config)
Constructs a DestinationTransport with the Role::Destination role.
Definition DestinationTransport.hpp:32
An in-process destination transport using a thread-safe queue.
Definition LocalDestination.hpp:34
int64_t pendingMessageCount() const noexcept override
Returns the current occupancy of the internal queue.
Definition LocalDestination.hpp:51
std::optional< MessagePtr > pop()
Retrieves and removes the oldest message from the queue.
Definition LocalDestination.hpp:58
bool deliver(MessagePtr message) override
Pushes the message into the internal synchronous queue.
Definition LocalDestination.hpp:47
void stop() noexcept override
Deactivates the transport and releases system resources.
Definition LocalDestination.hpp:40
DestinationTransport(Endpoint endpoint, nlohmann::json config)
Constructs a DestinationTransport with the Role::Destination role.
Definition DestinationTransport.hpp:32
void start(FdWatch::Poller &) override
Activates the transport and begins I/O operations.
Definition LocalDestination.hpp:39
Abstract interface for FD-based event polling.
Definition Poller.hpp:37
A high-performance, lock-free, Single-Producer Single-Consumer (SPSC) bounded queue.
Definition SpscFixedQueue.hpp:47
Definition Channel.hpp:25
std::unique_ptr< Message > MessagePtr
Unique ownership handle for messages.
Definition Message.hpp:27