Search code examples
c++socketszeromqbroker

ZeroMQ broker direct message


I'm developing a distributed application using ZeroMQ. I want to implement a broker to pass messages in a centralized host.

Imagine serveral clients requesting something, to a given server. The example in the ZeroMQ guide, several clients, request for something to the server and some not busy worker, does the work and replies the request.

I need the request to be directed. I mean, I want that server 5 (for instance), do the job. This using a broker in the middle to centralize the comunication in a single host.

Any idea?

EDIT

I drew a picture: https://docs.google.com/drawings/d/1kyh6agIG_3FsllPURSjJFTHGjv-Yg92mfOiTmCdEsO8/edit?usp=sharing communication example

The difference (I think) between my case2 and the load balancing broker example in the guide is that the brokers assigns a request to the first free worker. I need to do a request to a specific server. I hope now it is clear.

EDIT2

Even more clear. I need this exactly example. But I can't see how a client requests to a specific server. I run the example, but all request are replied by the first non busy server.


Solution

  • Found it!!

    This is exactly what I need. http://arslan.io/zeromq-request-slash-reply-to-a-specific-server-via-router-router-broker-in-go

    I hope it helps someone