[zeromq-dev] "multiplexing" an asynchronous API
Tom Bennett
tom.bennett at mail.zyzhu.net
Fri Dec 9 15:16:46 CET 2011
Hi,
I have an asynchronous API that is like a request-subscription: I call a
function to request subsciption of a topic, and my call-back function will
be called when events for the topic arrive. Note that it is not possible to
lose any mesage because it is a call-back.
Now I would like to put this API behind a server, so that multiple clients
living in separate processes can call the server which in turn calls the
API. I am wondering how tis can be implemented with 0mq. I have several
ideas:
1. I can use PUB/SUB and REQ/REP. First the client subscribes to the PUB
socket and then the client sends the request through REQ/REP. There are two
problems: 1) I am not sure how I can make sure the PUB/SUB is ready before
sending the REQ so that I won't lose any messages; 2) the PUB/SUB filter is
on the client side, which might be an issue.
2. I can use PUSH/PULL and REQ/REP. The problem here is that for each
client I will have to create a new PUSH socket on the server.
3. I can just use REQ/REP. If the API call-back is called once and only
once, this actually works beautifully. However, if it is a situation where
I send a request and there are multiple asynchronous responses, this does
not seem to work.
Any advices on how to handle this situation?
Thanks,
Tom
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20111209/fcf122af/attachment.htm>
More information about the zeromq-dev
mailing list