synapse-app-sdk
C++ SDK for Synapse Apps
Loading...
Searching...
No Matches
synapse::DataPublisher Class Reference

Class for publishing data using various transport mechanisms. More...

#include <data_publisher.hpp>

Public Member Functions

 DataPublisher (const PublisherType &publisher_type, zmq::context_t &zmq_context)
 Constructor for DataPublisher.
 ~DataPublisher ()
 Destructor - ensures socket is closed.
bool setup (const std::string &endpoint)
 Sets up the publisher with the specified endpoint.
template<typename T>
bool try_publish (const T &message)
 Non-blocking publish of a message.

Detailed Description

Class for publishing data using various transport mechanisms.

Currently supports ZMQ publisher socket with configurable endpoints.

Constructor & Destructor Documentation

◆ DataPublisher()

synapse::DataPublisher::DataPublisher ( const PublisherType & publisher_type,
zmq::context_t & zmq_context )
inline

Constructor for DataPublisher.

Parameters
publisher_typeType of publisher transport to use
zmq_contextZMQ context to use for socket creation

Member Function Documentation

◆ setup()

bool synapse::DataPublisher::setup ( const std::string & endpoint)
inline

Sets up the publisher with the specified endpoint.

Parameters
endpointEndpoint string for the publisher
Returns
true if setup was successful, false otherwise

◆ try_publish()

template<typename T>
bool synapse::DataPublisher::try_publish ( const T & message)
inline

Non-blocking publish of a message.

Attempts to publish a message without blocking. Returns false if publish fails.

Template Parameters
TProtocol Buffers message type to publish
Parameters
messageMessage to publish
Returns
true if message was published successfully, false otherwise

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