[zeromq-dev] Reading queued messages after disconnect

Matt Connolly matt.connolly at me.com
Fri Jan 3 00:38:05 CET 2014

On 3 Jan 2014, at 12:16 am, Pieter Hintjens <ph at imatix.com> wrote:
> On Wed, Jan 1, 2014 at 11:48 PM, Matt Connolly <matt.connolly at me.com> wrote:
>> Alternately, poll and while readable recv the messages. This is how I’m doing it at present. (But the ruby bindings doesn’t let me recv with no endpoints, whereas a C program can).
> Interesting. I'm also curious why you would want to do this. It seems
> wrong. Instead, you'd terminate a protocol properly with whatever
> handshake, and then destroy the socket.

One use case I have for this is a simple logging service. It has a PULL socket and receives messages which it writes to disk (among other things). At shutdown time I want to disconnect the socket so subsequent messages are queued at the sender's PUSH socket (and will be delivered when the machine/service restarts). I want to consume all messages that have been received before shutting down.

Certainly in more complex scenarios where duplex communication between services is important, then they can handshake a shutdown. I’m doing this already with a ROUTER based service and this works well.


More information about the zeromq-dev mailing list