The following figure helps us understand the flow of an item from the Publisher till it gets subscribed by the Subscriber:
The following discussion will help us understand the publishing-subscribing mechanism:
- The Publisher uses the subscribe() method denoting that the Subscriber can now subscribe the Publisher.
- The Subscriber subscribes the Publisher by invoking onSubscribe(). The Subscriber now has Subscription. Each Publisher defines its own Subscription and also has the logic to produce the data for the respective Subscription.
- The Subscriber uses the Subscription and requests for the items. ...