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

Class representing a consumer tap for receiving messages. More...

#include <taps.hpp>

Public Member Functions

 ConsumerTap (const std::string &name, const std::string &message_type_name, const std::function< void(zmq::message_t message)> &callback, zmq::context_t &zmq_context)
 Constructor for ConsumerTap.
 ~ConsumerTap ()
 Destructor - stops the consumer tap.
synapse::TapConnection connection () const
 Gets the connection information for this tap.
void start ()
 Starts the consumer tap.
void stop ()
 Stops the consumer tap.

Detailed Description

Class representing a consumer tap for receiving messages.

Creates a ZMQ SUB socket to receive messages of a specific type and processes them via a callback function running in a separate thread.

Constructor & Destructor Documentation

◆ ConsumerTap()

synapse::ConsumerTap::ConsumerTap ( const std::string & name,
const std::string & message_type_name,
const std::function< void(zmq::message_t message)> & callback,
zmq::context_t & zmq_context )
inline

Constructor for ConsumerTap.

Parameters
nameName of the tap
message_type_nameProtobuf message type name
callbackFunction to be called when a message is received
zmq_contextZMQ context to use for socket creation

Member Function Documentation

◆ connection()

synapse::TapConnection synapse::ConsumerTap::connection ( ) const
inline

Gets the connection information for this tap.

Returns
TapConnection object containing connection details

◆ start()

void synapse::ConsumerTap::start ( )
inline

Starts the consumer tap.

Launches a thread that continuously polls for messages and calls the callback function when a message is received.

◆ stop()

void synapse::ConsumerTap::stop ( )
inline

Stops the consumer tap.

Stops the read thread and waits for it to join.


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