[zeromq-dev] Not blocking forever when waiting for response
Doron Somech
somdoron at gmail.com
Sat Jun 18 18:52:49 CEST 2016
I don't recall such recommendation from the guide, actually req-rep is kind
of obsolete and I don't recommend to use it other than learning purpose.
dealer-router is more recommended.
CLIENT and SERVER are new socket types, SERVER is like ROUTER and CLIENT is
like dealer. They both thread-safe and only support single part message.
With SERVER you don't have identity, you need to set the routing id on the
frame, routing id is an integer.
Your pattern seems right, you might go for dealer instead of REQ. For the
worker socket type I actually think it is simpler to use dealer, so:
dealer-router-router-dealer
You only need a router at the worker if you support more than one broker
connecting to the dealer, if that is not the case you can just have a
dealer as the worker socket type.
On Sat, Jun 18, 2016 at 2:33 AM, Douglas Petican <dpetican at gmail.com> wrote:
> Thanks. That's what I had in mind. I read somewhere in the guide that
> dealer-router was not recommended to replace req-router for some reason.
> Is this correct? And what do you mean by client-server in the context of
> zmq? Can you explain it in terms of messaging patterns? I'm currently
> using req-router-router-router to enforce a 1:1 relationship between client
> and worker. My router-router broker actually spawns the worker
> dynamically. Thanks.
>
> <-Douglas Petican->
>
> On 2016-06-17 4:20 PM, Doron Somech wrote:
>
> Take a look at the lazy pirate example from the guide, it is exactly for
> that.
> Anyway, for that reason using REQ socket is not recommended, it is better
> to use dealer-router or even better, client-server.
>
> On Thu, Jun 16, 2016 at 2:17 AM, Douglas Petican <dpetican at gmail.com>
> wrote:
>
>> Just went through a sorta code review today and got asked the question:
>> what happens if Y module doesn't respond to X modules request? My answer
>> was: then I coded Y module wrong because the contract is that a request
>> always gets a reply. Then I started to think.... wait a sec what happens
>> if the modules are located on different hosts and the link between them
>> goes down after the request is made? Then surely the response would block
>> forever.
>>
>> I haven't tried it yet but I'm thinking that I need to use poll() with a
>> timeout and wait only so long for the POLLIN event. Then that means its
>> okay to actually receive the message. is that the way to do it? Thanks.
>>
>> --
>> <-Douglas Petican->
>>
>> _______________________________________________
>> zeromq-dev mailing list
>> zeromq-dev at lists.zeromq.org
>> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
>
>
> _______________________________________________
> zeromq-dev mailing listzeromq-dev at lists.zeromq.orghttp://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/20160618/0637d5c1/attachment.htm>
More information about the zeromq-dev
mailing list