[zeromq-dev] 0mq socket multiplexing (or "trunking")

Pieter Hintjens ph at imatix.com
Thu Nov 7 08:56:31 CET 2013


The usual answer is to do everything over a single dealer-router pair.


On Thu, Nov 7, 2013 at 2:49 AM, Winston Smith
<smith.winston.101 at gmail.com> wrote:
> I'm new to 0mq, I have read the book, but could use some advice!  I have
> played around with various types of sockets and 0mq seems pretty robust.
> I'm looking at using 0mq to replace some existing custom-sockets based code,
> basically, we have agents running on various systems that monitor that apps
> running on them.  The app has the following messaging patterns:
> 1) Pub-sub: The agent publishes periodic updates about the system,
> subscribers on the server listen and process the notifications.
> 2) Rep: The server can send requests to the agent, e.g. "ping", or "update"
> etc, the agent processes the request and replies.
> 3) Req: The agent can make requests to the server; the server replies with a
> response.
> So all of these patterns exist within 0mq, I've prototyped them and they
> work nicely.  However, I find I have to set up and allocate listens/connects
> for each of these.
> Is it possible to "trunk" or multiplex each of these patterns into a single
> channel?  I thought perhaps these patterns could actually be implemented
> using inproc: with a single dealer socket to the server, there would be a
> proxy type thread that would manage the marshaling of the individual inproc
> sockets onto the dealer with a corresponding proxy on the server that does
> the same.  Obviously, the proxy would also have to manage the message
> envelope to ensure that messages get routed appropriately and replies find
> their way home.
> Also, I'm hoping to use the curve encryption on the dealer socket to protect
> the messages in transit (not only for encryption, but authentication).
> Are there any examples of such a thing?  Or am I stuck with 3 connections
> per-agent?
> Thanks!
> -W.
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev

Pieter Hintjens
CEO of iMatix.com
Founder of ZeroMQ community
blog: http://hintjens.com

More information about the zeromq-dev mailing list