[zeromq-dev] REQ/REP newbie question

Amr Ali amr.ali.cc at gmail.com
Fri Aug 31 21:46:59 CEST 2012

Have you tried to use DEALER/ROUTER pattern (used to be called XREQ/XREP)?

I'd like to think of DEALER/ROUTER as the primitive for REQ/REP as it doesn't
constrain you having to reply to every request but of course you'll have to
manage socket IDs yourself to know whom to reply to only if needed.

On 08/31/2012 09:21 PM, Jeremy Selan wrote:
> From a newbie zmq user...
> I am using zmq to stream a series of queries/updates from a user interface to an
> underlying data model (using the ipc mechanism).
> Some of these messages - representing queries - are
> conceptually synchronous where the response is required.  And some of these
> messages - the push updates - are asynchronous (where the response value, an
> empty buffer, is ignored.
> I am currently using a single req/reply pattern for both the queries and the
> updates. This is obviously not ideal for performance, as it requires a needless
> round-trip for the update messages.
> I experimented with using two connections, req/rep along with push/pull, using
> the poller to do interleaved handling.  However, while this correctly models the
> message handling, the message handling no longer preserves ordering as it uses
> two independent sockets.
> While I could add a higher level mechanism to replicate the ordering,
> the simplicity of using a single zmq socket to preserve inherent message order
> is appealing.
> Is there a way to do req/rep where you can tell zmq to not expect
> reply? (Something like a send flag, "NO_RESPONSE_EXPECTED", for req/rep.)
> Is it possible to point both the req/rep and the push/pull at the same socket to
> achieve a similar effect, which does preserver ordering?
> Or an alternative best practice?
> Thanks!
> -- Jeremy
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Amr Ali

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: OpenPGP digital signature
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20120831/c12fbbb5/attachment.sig>

More information about the zeromq-dev mailing list