[zeromq-dev] Publisher subscriber internals

Susan Tharakan susantharakan83 at gmail.com
Wed Feb 23 08:08:27 CET 2011

Thanks Martin.

Makes sense.

On Wed, Feb 23, 2011 at 12:28 PM, Martin Sustrik <sustrik at 250bpm.com> wrote:

> Hi Susan,
> I have been poking around the zeromq publisher subscriber internals and
>> was curious about a particular design decision. I find that zmq_init_t
>> creates an engine for handling a socket and then relinquishes ownership
>> to the session object. I was wondering why such a design was chosen,
>> instead of the session object directly creating an engine object.
> The reason is that when engine (which encapsulates TCP socket) is created
> it's not clear which session it belongs to.
> Imagine there's a session bound to identity "A".
> Associated peer disconnects and reconnects after a while.
> When the listener object gets new TCP connection it has no idea what the
> identity of the peer is. So it passes the connection to zmq_init object
> which asynchronously reads the identity from the socket (identity is always
> the first message on a new connection). Once zmq_init reads the identity, it
> finds the session taking care of that identity and passes the engine to it.
> Martin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110223/cad37c2a/attachment.htm>

More information about the zeromq-dev mailing list