[zeromq-dev] patches for zmq_queue to support xreq xrep sockets

Jon Dyte jon at totient.co.uk
Fri Mar 12 02:10:15 CET 2010

Attached are a couple of patches to make the zmq_queue device usable.
I also had to fix the include paths in the forwarder and streamer since 
the repo re-org.

Note that at the moment I've only tested one-hop zmq_queue and currently 
in the
rep process which is the end of the chain, you have to do some manual 
code to get
the response to route back to the correct client.

This is the setup

 REQ* <--> ZMQ_QUEUE <-->  REP*
* can have multiple of these.

the config for the zmq_queue looks something like:-
        <bind addr = "tcp://lo:43210"/>
        <bind addr = "tcp://lo:43211"/>

Note about REP sockets:
This snippet just simply sends back the response with a copy,
the inbound message was one character.
However currently the first octet of the message is a length indicator 
the length of the addressing info. This needs to be copied into the 
response message.
This is only a temporary measure. The new extensions field of the wire 
format will make
this requirement go away.

      zmq::message_t request;

      unsigned char l = *((char*)request.data());
      zmq::message_t response(l+2); // l+2 = the octet, the address, and 
my 1 byte test message

      ::memcpy(response.data(), request.data(), l+2);


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-added-queue-class-to-make-zmq_queue-device-actually-.patch
Type: text/x-patch
Size: 3382 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100312/526d637e/attachment.bin>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0002-tidy-up-zmq_queue-and-adjust-include-path-since-the-.patch
Type: text/x-patch
Size: 3016 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20100312/526d637e/attachment-0001.bin>

More information about the zeromq-dev mailing list