NebulaStream  0.6.213
NebulaStream is a data and application management framework for the internet of things
NES::MQTTClientWrapper Class Reference

Helper class for MQTTSink. Provides a convenient way to choose between asynchronous and synchronous clients. More...

#include <MQTTClientWrapper.hpp>

Classes

class  UserCallback
 Helper class for synchronous client - Defines how to interact with broker replies and connection loss. More...
 

Public Member Functions

 MQTTClientWrapper (bool useAsyncClient, std::string const &address, std::string const &clientId, uint64_t maxBufferedMSGs, std::string const &topic, int qualityOfService)
 Creates the MQTTClientWrapper. More...
 
mqtt::async_client_ptr getAsyncClient ()
 get a pointer to the MQTT asynchronous client ONLY IF 'useAsyncClient' = true More...
 
mqtt::client_ptr getSyncClient ()
 get a pointer to the MQTT synchronous client ONLY IF 'useAsyncClient' = false More...
 
void connect (mqtt::connect_options connOpts)
 connect to an MQTT broker More...
 
void disconnect ()
 disconnect from an MQTT broker More...
 
void sendPayload (std::string payload)
 send a string to an MQTT broker More...
 
uint64_t getNumberOfUnsentMessages ()
 get the number of elements currently residing in the buffer (messages that have not been delivered yet) More...
 
void setCallback (UserCallback &cb)
 define a callback behaviour for the synchronous client More...
 

Detailed Description

Helper class for MQTTSink. Provides a convenient way to choose between asynchronous and synchronous clients.

Constructor & Destructor Documentation

◆ MQTTClientWrapper()

NES::MQTTClientWrapper::MQTTClientWrapper ( bool  useAsyncClient,
std::string const &  address,
std::string const &  clientId,
uint64_t  maxBufferedMSGs,
std::string const &  topic,
int  qualityOfService 
)

Creates the MQTTClientWrapper.

Parameters
useAsyncClientif true: use asynchronous client, else: use synchronous client
addressaddress name of MQTT broker
clientIdclient ID for MQTT client
maxBufferedMSGsmaximal number of messages that can be buffered by the client before disconnecting
Returns
MQTTClientWrapper

Member Function Documentation

◆ connect()

void NES::MQTTClientWrapper::connect ( mqtt::connect_options  connOpts)

connect to an MQTT broker

◆ disconnect()

void NES::MQTTClientWrapper::disconnect ( )

disconnect from an MQTT broker

◆ getAsyncClient()

mqtt::async_client_ptr NES::MQTTClientWrapper::getAsyncClient ( )

get a pointer to the MQTT asynchronous client ONLY IF 'useAsyncClient' = true

◆ getNumberOfUnsentMessages()

uint64_t NES::MQTTClientWrapper::getNumberOfUnsentMessages ( )

get the number of elements currently residing in the buffer (messages that have not been delivered yet)

◆ getSyncClient()

mqtt::client_ptr NES::MQTTClientWrapper::getSyncClient ( )

get a pointer to the MQTT synchronous client ONLY IF 'useAsyncClient' = false

◆ sendPayload()

void NES::MQTTClientWrapper::sendPayload ( std::string  payload)

send a string to an MQTT broker

◆ setCallback()

void NES::MQTTClientWrapper::setCallback ( UserCallback cb)

define a callback behaviour for the synchronous client


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