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

Martin Sustrik sustrik at 250bpm.com
Sat Mar 13 09:00:32 CET 2010


Jon,

Thanks for the patch! It's committed to the trunk now.

Martin

Jon Dyte wrote:
> The patches are submitted under the MIT License.
> 
> 
> Jon Dyte wrote:
>> Hi
>> 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:-
>> <queue>
>>    <in>
>>        <bind addr = "tcp://lo:43210"/>
>>    </in>
>>    <out>
>>        <bind addr = "tcp://lo:43211"/>
>>    </out>
>> </queue>
>>
>>
>>
>> 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 
>> detailing
>> 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;
>>      rep.recv(&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);
>>      rep.send(response);
>>
>>
>>
>> Jon
>>
>> ------------------------------------------------------------------------
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
> 
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev




More information about the zeromq-dev mailing list