Keep DataChange registrations and notifications local 27/9627/2
authorMoiz Raja <moraja@cisco.com>
Sun, 3 Aug 2014 13:36:13 +0000 (06:36 -0700)
committerMoiz Raja <moraja@cisco.com>
Sun, 3 Aug 2014 22:36:45 +0000 (15:36 -0700)
Here is how it works
--------------------
When a consumer registers for a datachange notification we first check if the Shard
to which this registration needs to be sent is local. If it is then we send the
registration to it. If it is not then we simply return a NoOpRegistration to the consumer.
This ensures that a DataChange registration stays local to a cluster member.

Now let's say we have 3 replicas and in all those replicas we do find a local shard for a
given module and we have 3 listener registrations. At this time we do not want all 3 members
to be notified of the change. We only want the node which is the Leader to notify it's listeners
of the change. To restrict that the DataChangeListener will only forward events to the listener
if the Shard sends it a message enabling notifications

Change-Id: I035bbdf34e2509047f4bcb475c443a761b08e68d
Signed-off-by: Moiz Raja <moraja@cisco.com>

No differences found