Reputation: 51
I would like to know if zmq already solves following problem (or) the application sitting on top of zmq needs to take care of it.
1) A central publisher which publishes data to all subscribers. This data is static in nature, something like configuration. The data can be modified at any point in time.
2) Multiple subscribers subscribe to messages from this publisher. The publisher can join at any point in time.
3) If data changes, publisher should just publish the diff to the existing subscribers.
4) If a subscriber joins later, the publisher should publish all the data (current configuration) to the new subscriber.
Zeromq guide suggests following for solving Slow Joiner syndrome but this does not solve above problem. http://zguide.zeromq.org/page:all#Slow-Subscriber-Detection-Suicidal-Snail-Pattern
Upvotes: 3
Views: 1182
Reputation: 6669
The Clone pattern from the Guide does precisely what you want.
Upvotes: 3
Reputation: 79461
The problem I'm seeing with your setup is that it requires all the subscribers to have the same state. If all subscribers are at version 7 and you publish the 7-to-8 diff, then they all update to version 8. But this requires a tightly-coupled state synchronization between nodes. How would you handle the case when subscribers get out of sync?
Consider this alternative setup:
i
joins the network, it sends an "update" request to the publisher, so that the publisher is aware of the subscriber's identity and his current version version[i]
i
up to dateThis approach has the following benefits:
Upvotes: 2