[zeromq-dev] PUB/SUB with multiple publishers

chris jugg at hotmail.com
Mon Jul 19 06:17:00 CEST 2010

Dmitri Toubelis <dmitri.toubelis <at> alkeron.com> writes:
> I have a scenario when I need to use PUB/SUB scheme with multiple publishers.

If I've understood you correctly...

You'll need a topology that looks like this:

pub                   sub
   \                 /
   /                 \
pub                   sub

Both the 'pub'lishers and the 'sub'scribers must "connect" to their respective
sockets, s1 and s2.

fsub and fpub must "bind" s1 and s2 sockets respectively and can use a simple
forwarder device as an implementation.

Basically, what you do, is create two sockets.  Bind s1 as ZMQ_PUB and bind s2
as ZMQ_SUB.  Create ZMQ_FORWARDER devices having s1 as the insocket, and s2 as
the outsocket.

Then, as you need, connect publishers to s1 and connect subscribers to s2.



More information about the zeromq-dev mailing list