BeeeOn Gateway
v2020.3.1-2-g6f737dc
Platform to interconnect the IoT world
|
Sending of messages via a GWSConnector might not be reliable. Messages that have been sent can never reach the remote server. The GWSResender maintains the sent messages (where a reply is expected). When no response or ack is received on time, such message is sent again. More...
#include <GWSResender.h>
Public Member Functions | |
void | setConnector (GWSConnector::Ptr connector) |
void | setResendTimeout (const Poco::Timespan &timeout) |
Configure timeout used to delay each resend. | |
void | run () override |
Implement scheduler of the waiting messages. | |
void | stop () override |
void | onTrySend (const GWMessage::Ptr message) override |
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. | |
void | onSent (const GWMessage::Ptr message) override |
Put the given message into the waiting list if it is re-sendable. After resendTimeout, such message is send again unless an appropriate response/ack has been delivered. More... | |
void | onResponse (const GWResponse::Ptr response) override |
When a response is received, this event is fired. | |
void | onAck (const GWAck::Ptr ack) override |
When an ack is received, this event is fired. | |
void | onOther (const GWMessage::Ptr message) override |
Process GWSensorDataConfirm messages. | |
Public Member Functions inherited from BeeeOn::GWSListener | |
virtual void | onConnected (const Address &address) |
Fired when the connection to the remote server is successfully created and it is possible to exchange messages. | |
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. | |
Protected Types | |
typedef std::multimap < Poco::Clock, GWMessage::Ptr > | WaitingList |
Protected Member Functions | |
WaitingList::const_iterator | resendOrGet (const Poco::Clock &now) |
Resend the oldest message waiting for resend if its timeout has expired. More... | |
WaitingList & | waiting () |
bool | resendable (const GWMessage::Ptr message) const |
Certain messages should be resended when there is no response/ack during the resendTimeout period. This applies to requests, responses with ack and sensor-data-export. More... | |
void | findAndDrop (const GWMessage::Ptr message) |
Find the given message in the waiting list and remove it. Such message is considered as delivered or gracefully failed. | |
Additional Inherited Members | |
Public Types inherited from BeeeOn::StoppableRunnable | |
typedef Poco::SharedPtr < StoppableRunnable > | Ptr |
Public Types inherited from BeeeOn::GWSListener | |
typedef Poco::SharedPtr < GWSListener > | Ptr |
Sending of messages via a GWSConnector might not be reliable. Messages that have been sent can never reach the remote server. The GWSResender maintains the sent messages (where a reply is expected). When no response or ack is received on time, such message is sent again.
If a message of an existing ID is to be resent, it replaces the previous message of the same ID scheduled for resent. Thus, only the most recent message of the same ID is always scheduled.
|
overridevirtual |
Put the given message into the waiting list if it is re-sendable. After resendTimeout, such message is send again unless an appropriate response/ack has been delivered.
Reimplemented from BeeeOn::GWSListener.
|
protected |
Certain messages should be resended when there is no response/ack during the resendTimeout period. This applies to requests, responses with ack and sensor-data-export.
|
protected |
Resend the oldest message waiting for resend if its timeout has expired.
|
overridevirtual |
Stop the runnable. The call should not block.
Implements BeeeOn::StoppableRunnable.
|
protected |