[zeromq-dev] Forwarding ROUTER to PUB

Lindley French lindleyf at gmail.com
Thu Jan 16 16:54:27 CET 2014

A problem I was wrestling with was, how do I deal with a TCP connection
where messages of different types may arrive, and may need to be dealt with
in different threads? The TCP socket can't be touched directly by multiple
threads, of course. The obvious solution was to immediately forward
messages arriving on the TCP socket to an inproc socket.

I then took it one step further: why not make that inproc socket a PUB
socket and make the first part of each message be a topic identifier, so
that whichever thread knows how to deal with a particular message can just
subscribe to it and ignore the rest?

That's a great design, right up until I try to do it with the TCP socket
being a ROUTER. Now, no matter what the first part of the sent message is,
the identity will end up being the first part on the receiving end. The
PUB/SUB won't work without some tweaking.

I don't want to just drop the identity; that's useful information. I could
swap the first two parts; that will work, but it's unintuitive and could
cause confusion down the road.

Any other ideas?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140116/37634c67/attachment.htm>

More information about the zeromq-dev mailing list