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

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

#include <dfx-core/transports/sources/MqSource.hpp>

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

Public Member Functions

 MqSource (Endpoint endpoint, nlohmann::json config)
 Initializes the MQ source with endpoint information.
void start (FdWatch::Poller &poller) override
 Opens the MQ and attaches to the poller.
void stop () noexcept override
 Closes the MQ and detaches from the poller.
Public Member Functions inherited from dfx::Core::SourceTransport
 SourceTransport (Endpoint endpoint, nlohmann::json config)
 Constructs a SourceTransport with the Role::Source 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 Member Functions inherited from dfx::Core::SourceTransport
bool transmitMessage (MessagePtr message)
 Forwards a message to the attached Channel for orchestration.
Protected Attributes inherited from dfx::Core::Transport
Role const _role
Endpoint _endpoint
nlohmann::json _config

Detailed Description

A remote source transport using POSIX Message Queues.

MqSource handles inter-process ingress. It monitors a POSIX Message Queue file descriptor and asynchronously reconstructs Message objects from raw bytes arriving from another process.

Lifecycle
  • Construction: Validates the MQ endpoint and configuration.
  • Start: Opens the message queue and registers the file descriptor with the provided FdWatch::Poller.
  • Processing: When data is available, data is unapcked and transmitMessage is called.
  • Stop: Unregisters from the poller and closes the queue.

Constructor & Destructor Documentation

◆ MqSource()

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

Initializes the MQ source with endpoint information.

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

Member Function Documentation

◆ start()

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

Opens the MQ and attaches to the poller.

Implements dfx::Core::Transport.

◆ stop()

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

Closes the MQ and detaches from the poller.

Implements dfx::Core::Transport.


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