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

Manager class for handling data taps. More...

#include <taps.hpp>

Public Member Functions

 TapManager (zmq::context_t &zmq_context, const std::string &registry_endpoint=kDefaultTapZMQIPC)
 Constructor for TapManager.
 ~TapManager ()
 Destructor - ensures all resources are cleaned up.
std::optional< synapse::TapConnection > add_tap (const std::string &name, const std::string &message_type_name)
 Adds a new tap with the specified name and message type.
std::optional< synapse::TapConnection > add_consumer_tap (const std::string &name, const std::string &message_type_name, const std::function< void(zmq::message_t message)> &callback)
 Adds a new consumer tap with the specified name and message type.
template<typename T>
bool send_message (const std::string &name, const T &message)
 Sends a message through a named tap.
void stop ()
 Stops the tap manager and releases resources.

Detailed Description

Manager class for handling data taps.

Provides functionality to create taps and send messages through them.

Constructor & Destructor Documentation

◆ TapManager()

synapse::TapManager::TapManager ( zmq::context_t & zmq_context,
const std::string & registry_endpoint = kDefaultTapZMQIPC )
explicit

Constructor for TapManager.

Parameters
zmq_contextZMQ context to use for socket creation
registry_endpointEndpoint for the tap registry

Member Function Documentation

◆ add_consumer_tap()

std::optional< synapse::TapConnection > synapse::TapManager::add_consumer_tap ( const std::string & name,
const std::string & message_type_name,
const std::function< void(zmq::message_t message)> & callback )
inline

Adds a new consumer tap with the specified name and message type.

Parameters
nameName of the tap
message_type_nameName of the message type for the tap
Returns
true if tap was added successfully, false otherwise

◆ add_tap()

std::optional< synapse::TapConnection > synapse::TapManager::add_tap ( const std::string & name,
const std::string & message_type_name )

Adds a new tap with the specified name and message type.

Parameters
nameName of the tap
message_type_nameName of the message type for the tap
Returns
Optional TapConnection, contains connection info if successful, empty if failed

◆ send_message()

template<typename T>
bool synapse::TapManager::send_message ( const std::string & name,
const T & message )
inline

Sends a message through a named tap.

Template Parameters
TProtocol Buffers message type to send
Parameters
nameName of the tap to send through
messageMessage to send
Returns
true if message was sent successfully, false otherwise

The documentation for this class was generated from the following files:
  • include/synapse-app-sdk/middleware/taps.hpp
  • src/middleware/taps.cpp