[zeromq-dev] zeromq DEALER client to multiple servers (ROUTER)
ashish nagar
ashish_nagarudr at yahoo.com
Sun Sep 29 06:33:08 CEST 2013
Thanks for the feedback. I will look at lbbroker examples.
In case I can't use the router broker socket approach in my use case, what do you think about creating multiple DEALER sockets on client side - one for each server endpoint (ROUTER socket)? Is it recommended by zeromq best practices?
In my use case, client has list of server endpoints and client selects server before sending the message.
Thanks
Ashish
________________________________
From: Matt Connolly <matt.connolly at me.com>
To: ashish nagar <ashish_nagarudr at yahoo.com>; ZeroMQ development list <zeromq-dev at lists.zeromq.org>
Sent: Sunday, September 29, 2013 1:58 AM
Subject: Re: [zeromq-dev] zeromq DEALER client to multiple servers (ROUTER)
If you connect a DEALER to multiple endpoints it will distribute messages to all of its connections. I think this is a round robin distribution.
If you have some specific logic where you need to choose which server to talk to, you would need a router socket so that you can specify the address. You could implement this as a separate routing so that your DEALER connects to one ROUTER on a broker and then the broker decides which server to talk to. See the lbbroker examples, such as:
https://github.com/imatix/zguide/blob/master/examples/C/lbbroker2.c
Cheers,
Matt
On 29 Sep 2013, at 4:25 am, ashish nagar <ashish_nagarudr at yahoo.com> wrote:
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 ?
> 1. Create DEALER socket on client side for each server endpoint (ROUTER socket).
> 2. Create only ONE DEALER socket on client side and add multiple endpoints.
>I tried option 2 - connecting to multiple endpoints but message
always goes to the first connected endpoint. followed following steps: - create DEALER socket - connect to first endpoint - then on the run time, add another endpoint to the socket by using
socket.connect(endpoint). Do I need to reconnect?
>In DEALER socket, there is no option to send message on a particular endpoint in case it is connected to multiple endpoints.
>
>
>Any idea?
>
>
>Thanks_______________________________________________
>zeromq-dev mailing list
>zeromq-dev at lists.zeromq.org
>http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
_______________________________________________
zeromq-dev mailing list
zeromq-dev at lists.zeromq.org
http://lists.zeromq.org/mailman/listinfo/zeromq-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20130928/0067537b/attachment.htm>
More information about the zeromq-dev
mailing list