[zeromq-dev] Help forwarding asynchronous events through ZeroMQ

Lucas Hope lucas.r.hope at gmail.com
Fri Aug 5 06:53:27 CEST 2011

Hi all,

This problem has come up a few time for me in some different domains. I have
asynchronous events which I want to publish through zeromq.

1. I can't just open a permanent socket and write to it, as sockets aren't
thread safe. Or could I? If the underlying asynchronous events have their
own lock (such as a pre-existing logging system), could I rely on that lock
for non-concurrent access to the socket?

2. I could open a new socket connection every time there is a message, but
that is likely inefficient, and I might have trouble with OS file handles
ongoing. I haven't tried this, but I might.

3. I could use an intermediary device such as a Java LinkedBlockingQueue to
funnel the asynchronous requests into a single forwarder thread. I have done
this, but for a low bandwidth application. Is it more or less efficient than

What is a good way to accomplish this task?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110805/f92b39c9/attachment.htm>

More information about the zeromq-dev mailing list