dfx 0.1.0
Linux-based dynamic dataflow executor
Loading...
Searching...
No Matches
dfx::Core::MqDestination Class Reference

A remote destination transport using POSIX Message Queues. More...

#include <dfx-core/transports/destinations/MqDestination.hpp>

Inheritance diagram for dfx::Core::MqDestination:
[legend]
Collaboration diagram for dfx::Core::MqDestination:
[legend]

Public Member Functions

 MqDestination (Endpoint endpoint, nlohmann::json config)
 Initializes the MQ destination.
void start (FdWatch::Poller &poller) override
 Opens the POSIX Message Queue for writing.
void stop () noexcept override
 Closes the underlying file descriptor.
bool deliver (MessagePtr message) override
 Serializes and writes a message to the Message Queue.
int64_t pendingMessageCount () const noexcept override
 Queries the MQ attributes for the current message count.
Public Member Functions inherited from dfx::Core::DestinationTransport
 DestinationTransport (Endpoint endpoint, nlohmann::json config)
 Constructs a DestinationTransport with the Role::Destination role.
Public Member Functions inherited from dfx::Core::Transport
 Transport (Role role, Endpoint endpoint, nlohmann::json config)
 Constructs a transport instance.
 DFX_DISABLE_COPY_AND_MOVE (Transport)
 Transport is not copiable nor movable.
virtual ~Transport ()=default
 Virtual destructor ensuring proper cleanup of derived transports.
template<DerivedFromTransport T>
bool is () const noexcept
 Check whether this transport is of a given derived type.
template<DerivedFromTransport T>
T & as () noexcept
 Cast this transport to a derived type (unchecked).
template<DerivedFromTransport T>
T const & as () const noexcept
 Cast this transport to a derived type (unchecked).
Role role () const noexcept
 Returns the Role (Source or Destination) of this transport.
bool isSource () const noexcept
 Returns true if this transport is a source.
bool isDestination () const noexcept
 Returns true if this transport is a destination.
Endpoint const & endpoint () const noexcept
 Gets the endpoint descriptor associated with this transport.
Channelchannel () const noexcept
 Gets the channel which this transport is attached to if any.
Portport () const noexcept
 Gets the port associated with this transport.
NodePtr node () const noexcept
 Gets the node associated with this transport.
nlohmann::json const & config () const noexcept
 Gets the JSON configuration used to initialize this transport.

Additional Inherited Members

Public Types inherited from dfx::Core::Transport
enum class  Role { Source , Destination }
 Defines the operational role of a transport relative to a channel. More...
Protected Attributes inherited from dfx::Core::Transport
Role const _role
Endpoint _endpoint
nlohmann::json _config

Detailed Description

A remote destination transport using POSIX Message Queues.

MqDestination serializes Message objects and writes them to a POSIX Message Queue identified by the provided Endpoint.

Behavior
  • Messages are packed into a binary format before being written to the MQ.
  • Delivery is non-blocking; if the MQ is full, deliver() will return false.

Constructor & Destructor Documentation

◆ MqDestination()

dfx::Core::MqDestination::MqDestination ( Endpoint endpoint,
nlohmann::json config )

Initializes the MQ destination.

Parameters
endpointThe mq:// URI for the target queue.
configAdditional configuration (e.g., max_message_size, max_message).

Member Function Documentation

◆ deliver()

bool dfx::Core::MqDestination::deliver ( MessagePtr message)
overridevirtual

Serializes and writes a message to the Message Queue.

Parameters
messageThe message to transmit.
Returns
true if the message was written to the kernel buffer.

Implements dfx::Core::DestinationTransport.

◆ pendingMessageCount()

int64_t dfx::Core::MqDestination::pendingMessageCount ( ) const
overridevirtualnoexcept

Queries the MQ attributes for the current message count.

Reimplemented from dfx::Core::DestinationTransport.

◆ start()

void dfx::Core::MqDestination::start ( FdWatch::Poller & poller)
overridevirtual

Opens the POSIX Message Queue for writing.

Implements dfx::Core::Transport.

◆ stop()

void dfx::Core::MqDestination::stop ( )
overridevirtualnoexcept

Closes the underlying file descriptor.

Implements dfx::Core::Transport.


The documentation for this class was generated from the following file: