RSB
0.7.0
|
A task that receives FragmentedNotifications
from a SpreadConnection
, deserializes them to events and notifies a handler with deserialized Events.
More...
#include <ReceiverTask.h>
Public Member Functions | |
ReceiverTask (SpreadConnectionPtr s, eventprocessing::HandlerPtr handler, InPushConnector *connector) | |
virtual | ~ReceiverTask () |
void | execute () |
void | setHandler (eventprocessing::HandlerPtr handler) |
void | setPruning (const bool &pruning) |
Enables or disables pruning of messages and waits until the changes are performed. |
Private Member Functions | |
void | notifyHandler (protocol::NotificationPtr notification) |
Notifies the handler of this task about a received event which is generated from an internal notification and the joined data that may originate from several fragments of the notification. | |
rsb::protocol::NotificationPtr | handleAndJoinFragmentedNotification (protocol::FragmentedNotificationPtr notification) |
Handles newly received notifications by extracting their data, joining the data if it is part of a multi-part message and returning the joined notification. |
Private Attributes | |
rsc::logging::LoggerPtr | logger |
SpreadConnectionPtr | con |
InPushConnector * | connector |
AssemblyPoolPtr | assemblyPool |
eventprocessing::HandlerPtr | handler |
boost::recursive_mutex | handlerMutex |
A task that receives FragmentedNotifications
from a SpreadConnection
, deserializes them to events and notifies a handler with deserialized Events.
Messages may be split into multiple FragmentedNotifications
to respect the spread limitations. Hence, there is an assembly strategy for multiple notifications forming one Event. An optional pruning for Event fragments may be enable to avoid a growing pool if FragmentedNotifications
are lost. As a default this pruning is disabled.
Definition at line 74 of file ReceiverTask.h.
rsb::spread::ReceiverTask::ReceiverTask | ( | SpreadConnectionPtr | s, |
eventprocessing::HandlerPtr | handler, | ||
InPushConnector * | connector | ||
) |
Definition at line 53 of file ReceiverTask.cpp.
|
virtual |
Definition at line 63 of file ReceiverTask.cpp.
void rsb::spread::ReceiverTask::execute | ( | ) |
Definition at line 66 of file ReceiverTask.cpp.
References con, handleAndJoinFragmentedNotification(), logger, notifyHandler(), and rsb::spread::SpreadMessage::REGULAR.
|
private |
Handles newly received notifications by extracting their data, joining the data if it is part of a multi-part message and returning the joined notification.
notification | notification to handler |
Definition at line 119 of file ReceiverTask.cpp.
References assemblyPool.
Referenced by execute().
|
private |
Notifies the handler of this task about a received event which is generated from an internal notification and the joined data that may originate from several fragments of the notification.
notification | notification with full data to notify about |
Definition at line 138 of file ReceiverTask.cpp.
References connector, rsb::protocol::fillEvent(), rsb::transport::ConverterSelectingConnector< WireType >::getConverter(), handler, handlerMutex, and logger.
Referenced by execute().
void rsb::spread::ReceiverTask::setHandler | ( | eventprocessing::HandlerPtr | handler | ) |
Definition at line 167 of file ReceiverTask.cpp.
References handler, and handlerMutex.
void rsb::spread::ReceiverTask::setPruning | ( | const bool & | pruning | ) |
Enables or disables pruning of messages and waits until the changes are performed.
Thread-safe method.
pruning | if true and not pruning, start pruning, else if false and pruning, stop pruning |
Definition at line 172 of file ReceiverTask.cpp.
References assemblyPool.
|
private |
Definition at line 121 of file ReceiverTask.h.
Referenced by handleAndJoinFragmentedNotification(), and setPruning().
|
private |
Definition at line 118 of file ReceiverTask.h.
Referenced by execute(), and ReceiverTask().
|
private |
Definition at line 119 of file ReceiverTask.h.
Referenced by notifyHandler().
|
private |
Definition at line 123 of file ReceiverTask.h.
Referenced by notifyHandler(), and setHandler().
|
private |
Definition at line 124 of file ReceiverTask.h.
Referenced by notifyHandler(), and setHandler().
|
private |
Definition at line 116 of file ReceiverTask.h.
Referenced by execute(), notifyHandler(), and ReceiverTask().