[zeromq-dev] Multiple publishers without inproc socket

Nicolas HUYNH nicolas.huynh at onera.fr
Wed May 25 16:36:21 CEST 2011


Thank you all for your replies !
I'm new to ZeroMQ and I tried too much to stick on the basic examples.
Now I proceed as follows and this works :

- Publisher(s) do :
   zmq::socket_t socket(context, ZMQ_PUB);
   socket.connect("tcp://localhost:5555");

- Subscriber(s) do :
   zmq::socket_t socket(context, ZMQ_SUB);
   socket.connect("tcp://localhost:6666");
   std::string filter = "<xxx>";
   socket.setsockopt(ZMQ_SUBSCRIBE, filter, filter.size());

- And the Forwarder process does :
   zmq::socket_t incoming(context, ZMQ_SUB);
   incoming.bind("tcp://*:5555");
   incoming.setsockopt(ZMQ_SUBSCRIBE, "", 0);
   zmq::socket_t outgoing(context, ZMQ_PUB);
   outgoing.bind("tcp://*:6666");
   zmq::device(ZMQ_FORWARDER, incoming, outgoing);

I will investigate PGM/EPGM transport later (as proposed by Maciej).

-Nicolas


> Hello
>
> I'm trying to build a ZeroMQ-based distributed application with a 
> message bus, that is,
> multiple publishers sending messages to multiple subscribers.
>
> I found examples using a ZMQ_FORWARDER device to do such a thing, but 
> they always
> use inproc sockets.
> In my case, all publishers run in different processes (and possibly 
> different machines on
> different OS - Win32 and Linux).
>
> Is there a way to do this with a device and TCP sockets ?
>
> Or do I have to code a forwarder process by hand ?
>
> Many thanks !
>
> -Nicolas
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110525/032bc928/attachment.htm>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: nicolas_huynh.vcf
Type: text/x-vcard
Size: 283 bytes
Desc: not available
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20110525/032bc928/attachment.vcf>


More information about the zeromq-dev mailing list