0
votes

I read this: http://api.zeromq.org/4-3:zmq-socket and, from my understanding, neither type of sockets comes anywhere close to requirements, which, I thought were simple... Essentially, I want ZMQ to work exactly the same way NATS works (I just don't have a decent client for NATS, otherwise I'd use it).

So, to describe the problem: I have a master node and a bunch of slave nodes. Master needs to send messages to nodes and receive responses asynchronously / out of bound (i.e. it should be possible to send more than one message before receiving a response). Slave nodes are all unique. I.e. round-robin, fair-queuing etc. is out of question: each slave must receive a designated message (sometimes there are groups of slaves who all need to receive the same message).

It might be also useful for slaves to talk to each other (not necessarily directly, maybe through the master). But, if this is not possible out of the box, I'd probably be OK with building it on top of something else, provided the other requirements are met.


So far I was looking at SERVER / CLIENT pair and DEALER / ROUTER, but neither really works because of how they send messages to random destinations.

1
Did you try the REQ/REP pattern? - Benyamin Jafari

1 Answers

0
votes

It sounds like two PUB/SUB sockets would work.

Master has two sockets

  • PUB socket sends messages with a designated ID (subject)
  • SUB socket (subscribed to all) receives messages with ID (subject) as reply from slaves

Each Slave has two sockets

  • SUB socket subscribe to ID (subject) its interested in
  • PUB socket to send back reply out of band with ID as subject.

Operation

  • The Master would send out messages with a specific subject
  • only the slave who subscribes to that subject would get the message.
  • The slave can receive multiple messages.
  • The slave can publish a reply to the master out of band with subject as ID on its pub socket
  • slaves can come and go dynamically