[zeromq-dev] Question Regarding XREP

Chuck Remes cremes.devlist at mac.com
Wed Dec 1 23:38:18 CET 2010


On Dec 1, 2010, at 4:19 PM, Praveen Baratam wrote:

> Dear Chuck,
> 
> Thanks for the quick reply.
> 
> Well if ever an Identity is reused, I guess the earlier socket connected with that identity will be orphaned and all the messages will be routed to the new socket with that ID. Effectively the session held by the old socket will be hijacked by the new one.
> 
> Is this the expected behavior? 
> 
> I know I am crossing the guidelines, but the behavior in this scenario is important to us.
> 
> Lets say the Identity envelope of a message is "ABCD" and there are XREQs with Identities such as "ABCD", "ABCD1", "ABCD2", "ABCD3" to the XREP in question. Will the message reach all these sockets? Is this what you suggested?

I don't know if "hijacking" the socket is expected behavior. I would hope that multiple sockets with the same identity connecting to one 0mq socket would cause an error. That sounds like a bad idea.

If you *close* a socket, reusing its identity later should be okay.

Given your example, a message routed to socket with identity "ABCD" should *only* go to socket "ABCD". It should *not* also go to "ABCD1", "ABCD2", etc. because those identities do not match.

What are you trying to accomplish? You might be choosing the wrong socket pattern to achieve your goals. Give us an idea of your goal and perhaps we can suggest a better solution.

cr





More information about the zeromq-dev mailing list