Zero Module Framework  1.0
A framework for running distributed modules using a ZMQ message bus
 All Classes Namespaces Files Functions Variables Friends Macros
zmf::messaging::IZmfMessagingService Class Referenceabstract

#include <IZmfMessagingService.hpp>

Inheritance diagram for zmf::messaging::IZmfMessagingService:
zmf::messaging::ZmqZmfMessagingServiceImplementation

Public Member Functions

virtual bool start (IZmfMessagingCoreInterface *const corePtr, std::shared_ptr< zmf::data::ModuleHandle > selfHandle, std::shared_ptr< zmf::config::IConfigurationProvider > config)=0
 
virtual void stop ()=0
 
virtual void peerJoin (std::shared_ptr< zmf::data::ModuleHandle > module)=0
 
virtual void peerLeave (std::shared_ptr< zmf::data::ModuleHandle > module)=0
 
virtual void subscribe (const zmf::data::MessageType &topic)=0
 
virtual void unsubscribe (const zmf::data::MessageType &topic)=0
 
virtual void publish (const zmf::data::ZmfMessage &msg)=0
 
virtual zmf::data::ZmfInReply sendRequest (const zmf::data::ModuleUniqueId &target, const zmf::data::ZmfMessage &msg)=0
 
virtual void cancelRequest (uint64_t requestID, bool manual)=0
 
virtual void sendReply (ExternalRequestIdentity requestID, const zmf::data::ZmfMessage &reply)=0
 
virtual void onDisable ()=0
 

Detailed Description

This class provides the interface definition for the ZMQ-module of ZMF. The IZmfMessagingCoreInterface class provides the logical counterpart. The Implementation

Author
Jonas Grunert
Date
created on 6/25/15.

Member Function Documentation

virtual void zmf::messaging::IZmfMessagingService::cancelRequest ( uint64_t  requestID,
bool  manual 
)
pure virtual

Removes the internal resources mapped to the given requestID. To be called internally from a ZmfInReply if it is cancelled.

Parameters
requestIDthe id of the request to cancel

Implemented in zmf::messaging::ZmqZmfMessagingServiceImplementation.

virtual void zmf::messaging::IZmfMessagingService::onDisable ( )
pure virtual

to be called when the module is disabled.

Implemented in zmf::messaging::ZmqZmfMessagingServiceImplementation.

virtual void zmf::messaging::IZmfMessagingService::peerJoin ( std::shared_ptr< zmf::data::ModuleHandle >  module)
pure virtual

To be called when ZMF learns about a new peer.

Parameters
modulethe ModuleHandle of the joining peer

Implemented in zmf::messaging::ZmqZmfMessagingServiceImplementation.

virtual void zmf::messaging::IZmfMessagingService::peerLeave ( std::shared_ptr< zmf::data::ModuleHandle >  module)
pure virtual

To be called when a previously known peer leaves.

Parameters
modulethe ModuleHandle of the leaving peer

Implemented in zmf::messaging::ZmqZmfMessagingServiceImplementation.

virtual void zmf::messaging::IZmfMessagingService::publish ( const zmf::data::ZmfMessage &  msg)
pure virtual

Publishes the given ZmfMessage as event under the topic of the message's MessageType

Parameters
msgthe message to publish

Implemented in zmf::messaging::ZmqZmfMessagingServiceImplementation.

virtual void zmf::messaging::IZmfMessagingService::sendReply ( ExternalRequestIdentity  requestID,
const zmf::data::ZmfMessage &  reply 
)
pure virtual

Sends the given reply to the sender of the request with the given id. Should be wrapped from the module.

Parameters
requestIDthe id of the request to reply to
responsethe response to send

Implemented in zmf::messaging::ZmqZmfMessagingServiceImplementation.

virtual zmf::data::ZmfInReply zmf::messaging::IZmfMessagingService::sendRequest ( const zmf::data::ModuleUniqueId &  target,
const zmf::data::ZmfMessage &  msg 
)
pure virtual

Sends the given message to the given peer. A ZmfInReply is returned providing a handle for the outstanding response.

Parameters
targetthe identity of the receiver
msgthe Message to send
Returns
ZmfInReply a handle for the outstanding response. May be passed to the module.

Implemented in zmf::messaging::ZmqZmfMessagingServiceImplementation.

virtual bool zmf::messaging::IZmfMessagingService::start ( IZmfMessagingCoreInterface *const  corePtr,
std::shared_ptr< zmf::data::ModuleHandle >  selfHandle,
std::shared_ptr< zmf::config::IConfigurationProvider >  config 
)
pure virtual

Starts the ZMQ Service. After the service successfully started, the other methods may be called and the implementation will start to deliver incoming events to the provided IZmfMessagingCoreInterface.

Parameters
corepointer to the IZmfMessagingCoreInterface implementation that provides methods implementations of this class will interact with.
selfHandleshared_ptr to the ModuleHandle describing the module instance running on top of this ZMF instance
Returns
Returns true if started successfully, false otherwise

Implemented in zmf::messaging::ZmqZmfMessagingServiceImplementation.

virtual void zmf::messaging::IZmfMessagingService::stop ( )
pure virtual

Stops the ZMQ Service. After the service is stopped, calling any method except the start method will not have any effect. Also the implementation will remove any state (peer information, outstanding messages) currently stored.

Implemented in zmf::messaging::ZmqZmfMessagingServiceImplementation.

virtual void zmf::messaging::IZmfMessagingService::subscribe ( const zmf::data::MessageType &  topic)
pure virtual

Adds a subscription for the given topic. Semantics are equivalent to the ZMQ subscription ones.

Parameters
topicthe MessageType to subscribe on

Implemented in zmf::messaging::ZmqZmfMessagingServiceImplementation.

virtual void zmf::messaging::IZmfMessagingService::unsubscribe ( const zmf::data::MessageType &  topic)
pure virtual

Removes a subscription for the given topic. Semantics are equivalent to the ZMQ subscription ones.

Parameters
topicthe MessageType to unsubscribe from

Implemented in zmf::messaging::ZmqZmfMessagingServiceImplementation.


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