Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the best way to send async no-reply messages between peers with ØMQ?

Tags:

zeromq

I have a small cluster of peers (e.g. 10 nodes) already publishing and subscribing for messages. This is working fine. The cluster is static and every node knows the address of the other nodes.

In my use-case I also need all the nodes to be able to send messages to any specific node, and all the nodes should listen for messages addressed to them. The sending node does not need a reply, should not have to wait for a reply and does not need to know that the other node has received the message.

What kind of pattern and socket types could be used to implement this?

I am quite new to ØMQ, and have looked the Freelance Pattern from the guide, more specifically Model Three - Complex and nasty. Is using the ROUTER-ROUTER approach described there appropriate in my case?

I'm thinking of letting every node bind to a ROUTER socket setting their address a identity (and "polling" it into their message loop), and also letting the node send on a ROUTER socket, specifying the receiving node address as identity.

Have I missed some simpler way of doing this? Using the approach above seems maybe a bit complex since I really don't need the handshake procedure giving the receiving end ability to send a reply.

like image 641
tle Avatar asked Mar 26 '12 21:03

tle


1 Answers

For sending work to a peer without needing a reply, I'd probably just use a Fanout pattern, which will let you more effectively "fire and forget".

Router and Dealer are really there for the "device" tier in an "extended" request / reply pattern.

like image 125
Shaun Avatar answered Nov 10 '22 02:11

Shaun