[zeromq-dev] xpub and xsub example

Charles Remes lists at chuckremes.com
Mon Jan 14 23:25:05 CET 2013


On Jan 14, 2013, at 4:10 PM, Mohit Jaggi <mohitjaggi at gmail.com> wrote:

> Hi All,
> I am looking for examples of xpub and xsub. My use case is that multiple threads in a process produce data that needs to be published over a TCP socket. I was thinking of letting them call "send" but it seems that that is not thread-safe. From the guide, it appears I can use inproc+xpub socket from producers to a proxy and let subscribers connect over TCP/xsub. However, there is no example code. 

I answered your question on irc. When asking a question, you should stick around for more than 5m to get an answer.

Create a forwarder device that all of your PUB sockets connect to. All SUB sockets should then subscribe to that forwarder. You do *not* need to mess with XPUB and XSUB sockets.

See here:

http://api.zeromq.org/3-2:zmq-proxy

and

http://zguide.zeromq.org/page:all#Intermediaries-and-Proxies

cr

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


More information about the zeromq-dev mailing list