[zeromq-dev] labels and the behavior of XREQ/XREP

Chuck Remes cremes.devlist at mac.com
Fri Sep 16 18:39:40 CEST 2011


While adding support for the 3.0 API changes to the Ruby FFI bindings, I came across some behavior that I don't understand.

I read through the thread from earlier this month (title "XREP/ROUTER no longer receive messages atomically	in 3.0/4.0") where some of this behavior was discussed. 

To recap, the wire protocol now has a field for tagging a message part as a "label." A label is used with XREQ/XREP/ROUTER/DEALER socket types for storing the routing envelope details. In 2.x this data was just a regular message part but it was separated from user content by a null message part. When reading a label part, checking the socket for RCVMORE returns false even if there are more parts (label or otherwise) to be read.

The thread appeared to have consensus that this behavior was incorrect and surprising. Instead, each label part should also return true for RCVMORE.

In my testing, I see that the original behavior still exists. Checking for RCVMORE on a label part returns false.

To make matters more confusing, the IDENTITY support is different. My understanding was that 3.0 would continue to support custom user-set identities just like 2.1.x, but my test results show that is not true.

I ran 4 tests with every combination of REQ, REP, XREQ and XREP socket types all with custom set IDENTITY. In no case did my custom IDENTITY make it through to the other side intact.

https://gist.github.com/1222475

Furthermore, the sending of label parts looked inconsistent to me.

When sending data between a REQ and REP socket, labels aren't exposed (as expected) and my user content was delivered correctly.

When sending data between a REQ and XREP socket, the XREP socket received 2 label parts (and RCVMORE was false on both) and my user content as the 3rd part. The label parts were gibberish and neither represented the custom IDENTITY that was set earlier.

When sending data between a XREQ and XREP socket, the XREP socket received *1* label part and my user content as the 2nd part. This is different from the case above (REQ to XREP) by missing one of the label parts. It worked but perhaps it should not have worked? Also, the label part had gibberish in it instead of the custom IDENTITY.

I'm quite confused over how the 3.0 API is supposed to work with labels and whether or not IDENTITY values are supposed to be preserved between peers. Can anyone shed some light on this?

cr




More information about the zeromq-dev mailing list