NebulaStream
0.6.213
NebulaStream is a data and application management framework for the internet of things
|
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... | |
Helper class for MQTTSink. Provides a convenient way to choose between asynchronous and synchronous clients.
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.
useAsyncClient | if true: use asynchronous client, else: use synchronous client |
address | address name of MQTT broker |
clientId | client ID for MQTT client |
maxBufferedMSGs | maximal number of messages that can be buffered by the client before disconnecting |
void NES::MQTTClientWrapper::connect | ( | mqtt::connect_options | connOpts | ) |
connect to an MQTT broker
void NES::MQTTClientWrapper::disconnect | ( | ) |
disconnect from an MQTT broker
mqtt::async_client_ptr NES::MQTTClientWrapper::getAsyncClient | ( | ) |
get a pointer to the MQTT asynchronous client ONLY IF 'useAsyncClient' = true
uint64_t NES::MQTTClientWrapper::getNumberOfUnsentMessages | ( | ) |
get the number of elements currently residing in the buffer (messages that have not been delivered yet)
mqtt::client_ptr NES::MQTTClientWrapper::getSyncClient | ( | ) |
get a pointer to the MQTT synchronous client ONLY IF 'useAsyncClient' = false
void NES::MQTTClientWrapper::sendPayload | ( | std::string | payload | ) |
send a string to an MQTT broker
void NES::MQTTClientWrapper::setCallback | ( | UserCallback & | cb | ) |
define a callback behaviour for the synchronous client