Reputation: 69
I am using ZEROMQ for distributed messaging application. Need to connect client (DEALER socket) to multiple servers (ROUTER socket on server side). What are my options on CLIENT side ?
I tried option 2 - connecting to multiple endpoints but message always goes to the first connected endpoint. followed following steps:
In DEALER socket, there is no option to send message on a particular endpoint in case it is connected to multiple endpoints.
Any idea?
Upvotes: 6
Views: 5235
Reputation: 38588
ZeroMQ encodes certain behaviors into socket types. These mainly deal with:
A DEALER socket is one that can connect to multiple peers, and uses LRU (least recently used, aka round-robin) to decide which peer gets each message. If you do not want this behavior, then you do not want a DEALER socket with multiple peers.
If you want to decide which peer gets a message, there are two options for this:
at run time, add another endpoint to the socket by using
socket.connect(endpoint)
. Do I need to reconnect?
No, you do not need to reconnect. You can add (and remove) peers at any time during the program.
Upvotes: 5