|
void | setOutputsCount (int count) |
|
void | setPriorityAssigner (GWSPriorityAssigner::Ptr assigner) |
|
void | setupQueues () |
| Setup queues based on configuration. This must be called before the connector is started.
|
|
void | send (const GWMessage::Ptr message) override |
| Put the message into a queue and notify sender to check queues for updates.
|
|
void | addListener (GWSListener::Ptr listener) |
| Register a GWSListener instance that would receive events related to the communication.
|
|
void | clearListeners () |
| Remove all registered listeners.
|
|
void | setEventsExecutor (AsyncExecutor::Ptr executor) |
| Configure an AsyncExecutor instance that would be used for GWSListener events delivery.
|
|
|
size_t | selectOutput () const |
|
void | updateOutputs (size_t i) |
|
bool | outputValid (size_t i) const |
|
GWMessage::Ptr | peekOutput (size_t i) const |
|
void | popOutput (size_t i) |
| Pop the first (oldest) message in the queue of the given index.
|
|
template<typename Event , typename Method > |
void | fireEvent (const Event &e, const Method &m) |
|
void | fireReceived (const GWMessage::Ptr message) |
|
void | setupLogger (Poco::Logger *logger=0) const |
|
Poco::Logger & | logger () const |
|
| Loggable (const ClassInfo &info) |
|
| Loggable (const std::type_info &info) |
|
Most GWSConnector implementations would solve the issue of sending prioritization and asynchronous queuing of outgoing messages. The AbstractGWSConnector aims on this issue.
AbstractGWSConnector implements a queuing mechanism for outgoing messages. Each message is appended to a queue based on its priority. The queue number 0 is the most urgent queue.
Each queue contains a statistic of count of messages sent from the queue. A message for output is selected based on the following algorithm:
- take queue[i] (initially i := 0) with status[i]
- sum all status[j] for j > i
- if the status[i] <= sum(status[all j]), use queue i
- i := i + 1, try again
Empty or unused queues are skipped. Summarization... The first queue must always send more messages then all the other queues. If the first queue sends more messages then available in other queues (the first queue has been satisfied), the following queue is used with the same algorithm.