[zeromq-dev] Publish / Subscribe vs Multicast

Martin Sustrik sustrik at 250bpm.com
Mon Feb 15 22:00:30 CET 2010

Hi Gonzalo,

> The original code does a lot of wiring to point the outputs of some
> programs to the inputs of other programs. As one example, send_requests
> creates an "exchange" called SEND_REQUESTS_OUT; later on, component1
> creates a "queue" called COMPONENT1_IN and "binds" SEND_REQUESTS_OUT to
> COMPONENT1_IN. Additionally, this all seems to depend on an external
> process called zmq_server.

> It seems in ZMQ 2.0 this binding of names and the zmq_server process are
> gone, right? So all I have to do is to specify proper endpoints for each
> of the current socket bind and connect calls?

Yes, the all functionality is all gone. That's why I've discouraged you 
from examining the old examples. Now you simply bind the sockets to 
appropriate endpoints and that's it. You need no central naming service 
like zmq_server.

> One other question: I reviewed the zmq_streamer.cpp source and noticed
> that both in_socket and out_socket are bound AND connected. Is this
> correct? Why would that be necessary? Shouldn't in_socket only be bound,
> and out_socket only be connected?

You can bind & connect a socket multiple times. For example, you can 
bind a PUB socket to PGM multicast group and at the same time you can 
connect to the remote logger service via TCP. Etc.

In your case (butterfly) you would want each zmq_streamer to bind both 
inbound and outbound sockets. Each of your components will simply 
connect to the upstram and downstream zmq_streamer.

The code in zmq_streamer simply checks the configuration XML file and 
executes any binds and/or connects specified in the file.


More information about the zeromq-dev mailing list