Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zeromq broadcast to entire network

I'm new to ZeroMQ, (and programming with sockets in general), but am trying to implement (in Java) a peer-to-peer model in ZeroMQ. What I would like is for when a node comes on-line, it broadcasts to the entire network an "I'm here, and you can reach me at this address:..." message.

I'm thinking that if 2 or more nodes appear on the network, they would be able to find each other without having to go through a known endpoint.

Does anyone have any ideas on how I could achieve this? Is this even possible with ZeroMQ?

like image 361
Ryan Caskey Avatar asked Oct 06 '22 12:10

Ryan Caskey


1 Answers

What you're asking for cannot be done with zmq. There is no mechanism (without a known and defined endpoint) that allows you to 'know' when a publisher comes online and its messages are ready for subscribing to.

That being said, it is quite trivial to set something of this sort up using a XPub and XSub router(which requires a known endpoint). You can also create your own 'endpoint' that all clients connect to using a REQ/REP socket. This will allow you to have a central (essentially a directory service) that you can then connect point to point subscribe/publish connections (which will keep your network duplication at its lowest).

like image 165
g19fanatic Avatar answered Oct 10 '22 04:10

g19fanatic