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

Abstract base class for all destination transports that deliver messages from a Channel. More...

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

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

Public Member Functions

 DestinationTransport (Endpoint endpoint, nlohmann::json config)
 Constructs a DestinationTransport with the Role::Destination role.
virtual bool deliver (MessagePtr message)=0
 Performs the actual delivery of a message.
virtual int64_t pendingMessageCount () const noexcept
 Return the number of pending message in this transport or -1 if unknown.
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).
virtual void start (FdWatch::Poller &poller)=0
 Activates the transport and begins I/O operations.
virtual void stop () noexcept=0
 Deactivates the transport and releases system resources.
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

Abstract base class for all destination transports that deliver messages from a Channel.

A DestinationTransport represents the "Target" side of a Channel. It is responsible for the final stage of the message lifecycle: taking a message that has passed through the Channel's hooks and delivering it to the intended recipient.

Constructor & Destructor Documentation

◆ DestinationTransport()

dfx::Core::DestinationTransport::DestinationTransport ( Endpoint endpoint,
nlohmann::json config )
inline

Constructs a DestinationTransport with the Role::Destination role.

Parameters
endpointThe target endpoint descriptor.
configAdditional JSON configuration specific to this transport instance.

Member Function Documentation

◆ deliver()

virtual bool dfx::Core::DestinationTransport::deliver ( MessagePtr message)
pure virtual

Performs the actual delivery of a message.

This method is called by dfx::Core::Channel::transmit after all pre-delivery checks and hooks have passed.

Parameters
messageThe message to deliver.
Returns
true if delivery was successful (or the message was enqueued); false if the delivery failed (e.g., network down or queue full).

Implemented in dfx::Core::LocalDestination, dfx::Core::MqDestination, dfx::Core::UdpDestination, and dfx::Plugins::CDestinationTransport.

◆ pendingMessageCount()

virtual int64_t dfx::Core::DestinationTransport::pendingMessageCount ( ) const
inlinevirtualnoexcept

Return the number of pending message in this transport or -1 if unknown.

Reimplemented in dfx::Core::LocalDestination, dfx::Core::MqDestination, and dfx::Plugins::CDestinationTransport.


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