[zeromq-dev] Behavior of Labels, Identities, and Socket Types in 3.0

Gregory Szorc gregory.szorc at gmail.com
Thu Oct 27 03:26:02 CEST 2011


On 10/26/11 12:37 PM, MinRK wrote:
> Here's a script with pyzmq that runs various combinations of sockets,
> and a side-by-side diff comparing the behaviour when run with 2.1.10 vs
> 3.0.2:
>
> https://gist.github.com/1317498
>
> Should be trivial to add more socket combinations.

Great work!

I immediately noticed an inconsistency between the results and the docs.

 From zmq_socket:

> When a 'ZMQ_REQ' socket is connected to a 'ZMQ_ROUTER' socket, in addition to the
> _identity_ of the originating peer each message received shall contain an empty
> _delimiter_ message part. Hence, the entire structure of each received message
> as seen by the application becomes: one or more _identity_ (label) parts, an
> empty _delimiter_ part, and one or more _data parts_.

 From your 3.0 output:

> Testing REQ -> ROUTER
>   REQ sending 'hi': ok
>   ROUTER receiving: ['REQ', 'O\xce\xb5\xee', 'hi']

No empty message :(

I noticed a commit in 3.0 today that seems to touch code at the heart of 
this thread: 
https://github.com/zeromq/zeromq3-0/commit/5c42a8aa3bc3a914e00223e12340443a1443c541. 
I haven't tested that commit yet. Maybe it makes the code consistent 
with the docs?

Anyway, I fixed my application by changing all the DEALER and ROUTER 
sockets (back to) XREQ and XREP. Like I said in my initial post, I 
prefer 3.0's explicit label model rather than the empty message 
convention of 2.x. Still, I'd like some (official) feedback on expected 
behavior and best practices for 3.0.

Greg




More information about the zeromq-dev mailing list