ZIO
Python and C++ interface to ZeroMQ and Zyre
Public Member Functions | List of all members
zio::domo::Worker Class Reference

#include <worker.hpp>

Public Member Functions

 Worker (zio::socket_t &sock, std::string broker_address, std::string service)
 
 ~Worker ()
 
zio::multipart_t work (zio::multipart_t &reply)
 
void recv (zio::multipart_t &request)
 
void send (zio::multipart_t &reply)
 

Detailed Description

The ZIO domo worker API

Applications may use a Worker to simplify participating in the GDP worker subprotocol. The protocol is exercised through calls to Worker::work().

The application must arrange to use the "clientish" socket corresponding to what is in use by the broker but otherwise, differences related to the socket type are subsequently erased by this class.

Definition at line 21 of file worker.hpp.

Constructor & Destructor Documentation

◆ Worker()

Worker::Worker ( zio::socket_t sock,
std::string  broker_address,
std::string  service 
)

Create a worker providing service. Caller keeps socket eg so to poll it along with others.

Definition at line 8 of file domo_worker.cpp.

◆ ~Worker()

Worker::~Worker ( )

Definition at line 31 of file domo_worker.cpp.

Member Function Documentation

◆ recv()

void Worker::recv ( zio::multipart_t &  request)

Recieve a request. Note, if no request is pending, this will wait for at most one heartbeat and return leaving the request empty. If the request is not empty a subsequent send() shall be made.

Definition at line 72 of file domo_worker.cpp.

◆ send()

void Worker::send ( zio::multipart_t &  reply)

Send a reply. A reply must only be sent in response to a request. Note, unlike using work() it is not required, but still allowed, to send an initial empty reply. Empties will simply be ignored.

Definition at line 60 of file domo_worker.cpp.

◆ work()

zio::multipart_t Worker::work ( zio::multipart_t &  reply)

Send reply from last request, if any, and get new request. Both reply and request multiparts begin with "Frames 5+ request body" of 7/MDP. This will only return when there is a request. It will internally allow a timeout and a reconnect to the broker. If owner of the Worker needs to get time to do other things while waiting for a request then send() and recv() may be used.

Definition at line 121 of file domo_worker.cpp.


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