[zeromq-dev] match request and reply
Chuck Remes
lists at chuckremes.com
Wed Jul 4 17:16:11 CEST 2012
On Jul 4, 2012, at 5:22 AM, Daniel Krikun wrote:
> Hello,
>
> I'm building a service-oriented system. A client sends a request to create some entity on the server. The server creates the entity and then replies with the entity's handle, so that the client can send more requests regarding the entity (i.e. modify/delete it).
> I need to match the request to create an entity with the reply containing its handle (otherwise a client could potentially confuse between different entities' handles).
>
> Is there any recommended way do that in zeromq? Any 'best practices'?
I usually use the Majordomo protocol / pattern as the basis for most of the work I do.
> If I understand that correctly, using REQ-REP socket combination ensures that the reply will match the request, however:
> 1. The server is multi-threaded and does not ensures first-come-first-served policy
You solve this by using Dealer/Router.
> 2. Some request are left without reply intentionally, which is not possible with REQ-REP, so I actually use DEALER-DEALER combination.
You should use Dealer/ROUTER instead of Dealer/Dealer.
cr
More information about the zeromq-dev
mailing list