[zeromq-dev] inproc pub/sub socket connection

Pieter Hintjens ph at imatix.com
Thu Nov 18 19:33:52 CET 2010


On Thu, Nov 18, 2010 at 6:51 PM, T-zex <tranzenziuzex at gmail.com> wrote:
> What we have is:
>
> inproc(a)---
>               |
>               Incoming(c)
>               |
> inproc(b)--
>
> And the question is when we bind a and b and then do connect on c, is
> message delivery guaranteed form a and b to c? or do we need to do
> extra coordination?

You'd want to bind on c and then connect from a and b, and use
explicit coordination to ensure the connect happens after the bind.

My previous emails were unclear, I suggested you connect and bind one
socket.  In fact if a and b were child threads of c, what you'd do is:

- create three sockets, call them socka, sockb, sockc
- bind sockc to the inproc endpoint
- connect socka and sockb to the inproc endpoint
- start a thread for a, and pass it socka
- start a thread for b, and pass it sockb

That is the most elegant coordination mechanism I know of today.  It
requires 2.1.0 and is not documented in the Guide.  The alternatives
explained in the Guide tend to involve sleep() statements.

As Chuck says, maybe future versions of 0MQ will support disconnected inproc.

-Pieter



More information about the zeromq-dev mailing list