RSB  0.7.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
rsb::spread::ReceiverTask Class Reference

A task that receives FragmentedNotifications from a SpreadConnection, deserializes them to events and notifies a handler with deserialized Events. More...

#include <ReceiverTask.h>

Collaboration diagram for rsb::spread::ReceiverTask:
Collaboration graph

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
InPushConnectorconnector
AssemblyPoolPtr assemblyPool
eventprocessing::HandlerPtr handler
boost::recursive_mutex handlerMutex

Detailed Description

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.

Author
swrede
jwienke

Definition at line 74 of file ReceiverTask.h.

Constructor & Destructor Documentation

rsb::spread::ReceiverTask::ReceiverTask ( SpreadConnectionPtr  s,
eventprocessing::HandlerPtr  handler,
InPushConnector connector 
)

Definition at line 53 of file ReceiverTask.cpp.

References con, and logger.

rsb::spread::ReceiverTask::~ReceiverTask ( )
virtual

Definition at line 63 of file ReceiverTask.cpp.

Member Function Documentation

void rsb::spread::ReceiverTask::execute ( )

Definition at line 66 of file ReceiverTask.cpp.

References con, handleAndJoinFragmentedNotification(), logger, notifyHandler(), and rsb::spread::SpreadMessage::REGULAR.

Here is the call graph for this function:

NotificationPtr rsb::spread::ReceiverTask::handleAndJoinFragmentedNotification ( protocol::FragmentedNotificationPtr  notification)
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.

Parameters
notificationnotification to handler
Returns
pointer to the joined notification

Definition at line 119 of file ReceiverTask.cpp.

References assemblyPool.

Referenced by execute().

Here is the caller graph for this function:

void rsb::spread::ReceiverTask::notifyHandler ( protocol::NotificationPtr  notification)
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.

Parameters
notificationnotification 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().

Here is the call graph for this function:

Here is the caller graph for this function:

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.

Parameters
pruningif true and not pruning, start pruning, else if false and pruning, stop pruning

Definition at line 172 of file ReceiverTask.cpp.

References assemblyPool.

Member Data Documentation

AssemblyPoolPtr rsb::spread::ReceiverTask::assemblyPool
private

Definition at line 121 of file ReceiverTask.h.

Referenced by handleAndJoinFragmentedNotification(), and setPruning().

SpreadConnectionPtr rsb::spread::ReceiverTask::con
private

Definition at line 118 of file ReceiverTask.h.

Referenced by execute(), and ReceiverTask().

InPushConnector* rsb::spread::ReceiverTask::connector
private

Definition at line 119 of file ReceiverTask.h.

Referenced by notifyHandler().

eventprocessing::HandlerPtr rsb::spread::ReceiverTask::handler
private

Definition at line 123 of file ReceiverTask.h.

Referenced by notifyHandler(), and setHandler().

boost::recursive_mutex rsb::spread::ReceiverTask::handlerMutex
private

Definition at line 124 of file ReceiverTask.h.

Referenced by notifyHandler(), and setHandler().

rsc::logging::LoggerPtr rsb::spread::ReceiverTask::logger
private

Definition at line 116 of file ReceiverTask.h.

Referenced by execute(), notifyHandler(), and ReceiverTask().


The documentation for this class was generated from the following files: