So guys, now finally we will going to implement the notification and subscription.
So so far we have created a publisher thread and we have created a couple of subscriber threads and
we have implemented a data source which is nothing but a routing table, and it is the publisher thread
which performs Crud operations on this data source.
Right.
So far we have not yet implemented any mechanism using which subscriber can express their interest in
the particular entry of a data source.
And also we have not implemented any mechanism using which whenever a publisher updates the data source,
a notification is sent to the subscriber about the update.
Right?
So this is what we will going to implement next.
So we will going to implement the subscription.
Subscription means that allow subscribers to subscribe or unsubscribe for a particular entry of interest
for notifications.
So it is the subscriber responsibility to express interest in a particular entry in a data source.
And the other part is the notification.
That is, whenever the publisher updates any entry in the data source, we need to notify all the subscribers
which are interested in that particular entry whenever that entry is updated by the publisher.
Right.
So notification is a communication from the data source to the subscriber where a subscription is a
communication from the subscriber towards the data source.
Now note that in this diagram we have precisely captured the architecture of a publisher subscriber
model.
In this architecture you can see that publisher is absolutely unaware of the presence of subscribers.
Publisher don't even know there is any subscriber or not.
All publisher does is to update the data source.
Right?
It is the data source which is aware of the subscribers, right.
So let us see how we will going to implement the mechanism of subscription and notification.