[zeromq-dev] Need help in creating multiple publisher and subscribers

Chuck Remes lists at chuckremes.com
Thu Aug 23 14:32:56 CEST 2012

On Aug 23, 2012, at 4:21 AM, girish kumar wrote:

> >> Typically, we do zero MQ bind to a port in publisher code. But, in this case how to bind the multiple publisher threads on to the same port. This is fine with subscriber threads as they simply do zero MQ socket connect.

Use a FORWARDER device. It binds to an incoming and outgoing port. Your multiple publishers connect to the incoming port. Your multiple subscribers connect to the outgoing port. The device in the middle makes sure that all published messages are sent to all subscribers.

> I am trying to have a global message queue shared between multiple publisher threads and multiple subscriber threads. Can you please give suggestions in these lines. Can this be achieved at all, with out using locking mechanisms.

See above.

It's obvious that you have not read the documentation yet. Or, if you did read it, then you did not understand it yet. I suggest reading it again. These are *very basic* questions you are asking. Read the guide again.


It is full of examples coded in multiple different languages. It also covers all of these basic questions and several more that you haven't gotten around to asking yet (but you will).

Also, read the FAQ.


Good luck.


More information about the zeromq-dev mailing list