BeeeOn Gateway
v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
|
GWSQueuingExporter implements stop-and-go exporting logic based on the QueuingExporter. The GWSQueuingExporter is to be explicitly registered as a GWSListener to a selected GWSConnector instance. The same GWSConnector instance should then be used for sending of messages. More...
#include <GWSQueuingExporter.h>
Public Types | |
typedef Poco::SharedPtr < GWSQueuingExporter > | Ptr |
Public Types inherited from BeeeOn::QueuingExporter | |
typedef Poco::SharedPtr < QueuingExporter > | Ptr |
Public Types inherited from BeeeOn::StoppableRunnable | |
typedef Poco::SharedPtr < StoppableRunnable > | Ptr |
Public Types inherited from BeeeOn::GWSListener | |
typedef Poco::SharedPtr < GWSListener > | Ptr |
Public Member Functions | |
void | setActiveCount (int count) |
Configure how many SensorData instances to acquire while exporting data, i.e. it denotes a batch size that is send via a single GWSensorDataExport message. | |
void | setAcquireTimeout (const Poco::Timespan &timeout) |
Configure how long to wait until the QueuingExporter::acquire() operation returns a result. Tweaking the timeout an the activeCount property might lead to different performance. | |
void | setSendFailedDelay (const Poco::Timespan &delay) |
Configure delay for the next send attempt, if the current send() fails. | |
void | setConnector (GWSConnector::Ptr connector) |
Configure GWSConnector instance to send data through. | |
void | onConnected (const Address &address) override |
Wake-up failed sending when it seems that the connection is up again. | |
void | onOther (const GWMessage::Ptr message) override |
Receive GWSensorDataConfirm messages via this method. | |
void | run () override |
void | stop () override |
Public Member Functions inherited from BeeeOn::QueuingExporter | |
bool | ship (const SensorData &data) override |
void | setStrategy (const QueuingStrategy::Ptr strategy) |
void | setSaveThreshold (const int dataCount) |
void | setSaveTimeout (const Poco::Timespan &timeout) |
void | setStrategyPriority (const int percent) |
Public Member Functions inherited from BeeeOn::GWSListener | |
virtual void | onDisconnected (const Address &address) |
Fired when the connection to the remote server is considered broken or when it is disconnected on a request. | |
virtual void | onRequest (const GWRequest::Ptr request) |
When a request is received, this event is fired. | |
virtual void | onResponse (const GWResponse::Ptr response) |
When a response is received, this event is fired. | |
virtual void | onAck (const GWAck::Ptr ack) |
When an ack is received, this event is fired. | |
virtual void | onTrySend (const GWMessage::Ptr message) |
Fire when a message is about to be sent to the server. After the send is successful (no network failure), the GWSListener::onSend() event would be generated as well. | |
virtual void | onSent (const GWMessage::Ptr message) |
Fire when a message is being sent to the server. There might be a delay between putting a messing into an output queue and the actual sending process. This event allows to track such delay. | |
Additional Inherited Members | |
Protected Member Functions inherited from BeeeOn::QueuingExporter | |
void | acquire (std::vector< SensorData > &data, size_t count, const Poco::Timespan &timeout) |
void | ack () |
void | reset () |
bool | empty () const |
Protected Member Functions inherited from BeeeOn::Loggable | |
void | setupLogger (Poco::Logger *logger=0) const |
Poco::Logger & | logger () const |
Loggable (const ClassInfo &info) | |
Loggable (const std::type_info &info) | |
Static Protected Member Functions inherited from BeeeOn::Loggable | |
static Poco::Logger & | forMethod (const char *name) |
static Poco::Logger & | forClass (const ClassInfo &info) |
static Poco::Logger & | forClass (const std::type_info &info) |
template<typename T > | |
static Poco::Logger & | forInstance (const T *i) |
static void | configureSimple (Poco::Logger &logger, const std::string &level) |
static void | logException (Poco::Logger &logger, const Poco::Message::Priority priority, const Poco::Exception &e, const char *file, size_t line) |
GWSQueuingExporter implements stop-and-go exporting logic based on the QueuingExporter. The GWSQueuingExporter is to be explicitly registered as a GWSListener to a selected GWSConnector instance. The same GWSConnector instance should then be used for sending of messages.
GWSQueuingExporter exports data in batches (of size activeCount). Each batch must be first confirmed from the Gateway Server before another one is sent. This provides better reliablity and allows to prevent data losses related to connection or power issues (when the right QueuingStrategy is used).
|
overridevirtual |
Stop the runnable. The call should not block.
Implements BeeeOn::StoppableRunnable.