although I went through the guide I cant find a way to do the following:
we have n publishers,
we have m subscribers.
Each subscriber subscribes to certain type of msg(one publisher can send more than one kind of the message, multiple pubs can emit msgs of same type).
How to create N to N(or N to 1 to N) pattern in 0MQ that does that?
Pattern? A publisher will accept any number of subscribers, and your subscribers can connect to multiple publishers. I don't see any issue here, just go ahead and do it.
In the future, perhaps you'll be better served by stating what you want to accomplish, rather than how you think it should be done. Just hooking up a bunch of subscribers to a bunch of publishers might not be the best way to go about whatever it is that you're doing.
0MQ automatically allows N to M networks; just connect each subscriber to each publisher. That can become a burden to manage, in which case you can use a simple proxy that all publishers and subscribers connect to, see http://zguide.zeromq.org/page:all#toc36.
I have done a simple example in C which uses the built in zmq forwarder device to forward messages from N publishers to N subscribers. The code is available at https://gitorious.org/hellozmq
© 2022 - 2024 — McMap. All rights reserved.