#include <CZMQRouterTransport.h> class CZMQRouterTransport : public CFanoutTransport { public: CZMQRouterTransport(const char* pUri); virtual void recv(void** ppData, size_t& size); virtual void send(iovec* parts, size_t numParts); virtual void end(); };
This class implements a fanout transport using
the ZeroMQ ROUTER/DEALER communication pattern
(see CZMQDealerTransport
)(3daq).
ZMQ routera use a pull protocol in which each
worker sends a request for data which is honored
by the DEALER.
The protocol of getting pull requests and then providing them is totally transparent to the users of this class. Each call to send sends the data as a work item to some worker process running the DEALER protocol.
Since pull requests require the DEALER to have set up
an id, the pull requests build up a picture of the
client ids. This picture is used by
end
to ensure that all
clients see an end condition.
CZMQRouterTransport(const char* pUri);
This constructor creates the
ROUTER socket and
does a bind to ensure that DEALERS
can connect.
pUri
is the ZeroMQ
URI that specifies the socket end point.
virtual void recv(void** ppData, size_t& size);
The ROUTER socket only supports sending data.
A call to this method results in a
std::logic_error
exception
virtual void send(iovec* parts, size_t numParts);
Sends the message indicated to the next worker that requests data.
virtual void end();
Indicates to all connected clients no more data will be available. End of data is indicated by a message that contains a single message point with a zero length.