[zeromq-dev] bidirectional communication howto?

Aamir M aamirjvm at gmail.com
Wed Mar 11 19:40:35 CET 2009


How is bi-directional communication usually achieved in ZeroMQ? For
example, suppose I have a single server process and multiple client
processes connected to the server. One option is for the server to
create a global exchange (for pushing messages to clients) and a
global queue (for receiving messages from clients). Is this something
that is typically done? Or is it more common for both ends of the
connection to create two exchanges (one global, one local) and two
queues (global, local) ... for a total of 8 exchanges/queues for each
bidirectional communication channel?

One issue is that anytime a you create a local ZeroMQ object and try
to bind it to a global object, there is a possibility that the global
object will be unavailable which causes ZeroMQ to immediately assert
and fail. Currently I avoid this problem by ensuring that critical
processes (such as a server process) only declare global objects, and
leave the "dangerous" binding step to the client process.

So essentially I am trying to understand when to use global objects
and when to use local objects. The v0.3 whitepaper mentions that:

    * Message producing application creates an exchange.
    * Message consuming application creates a queue.
    * One of the applications establishes a binding between the
exchange and the queue.
    * Message producing application sends messages to the exchange.
    * Message consuming application retrieves messages from the queue.

But what about the local versus global issue? Also, it says "one of
the applications establishes a binding" but how does one decide which
application should establish the binding?


More information about the zeromq-dev mailing list