[zeromq-dev] REQ/REP Take 2

Jeremy Selan jeremy.selan at gmail.com
Fri Aug 31 21:47:46 CEST 2012


(resending, looks like the original question didnt make it though.)

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
req/reply where the roundtrip is required.  And some of these messages
are more appropriate for push/pull updates as a response is not
required.

However, I am currently using a single req/reply pattern for both the
queries and the updates, where the reply for the 'push' updates is
ignored. This is not ideal, as it requires a needless round-trip for
the substantial number of update messages.

I experimented with using two connections, req/rep along with
push/pull, using the poller to do interleaving.  However, this
approach as far as I can tell does not preserve ordering. 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.

What is a recommended best practice for achieving this?

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.)

Or is it possible to point both the req/rep and the push/pull (and
poller) at a single socket? Would this preserve ordering?

Or do I bite the bullet and use a higher-level mechanism (user
buffering,message index) to maintain ordering across a polled
push/pull + req/reply?

Thanks!

-- Jeremy



More information about the zeromq-dev mailing list