Member-only story

Reactive Java World — 1

Sivaram Rasathurai
2 min readMar 31, 2022

Reactive Streams Specification has four interfaces to talk in a reactive way between the applications.

Four Interfaces are

  1. Publisher
  2. Subscriber
  3. Subscription
  4. Processor

Basically, when we need to consume data then we will act as subscribers. and there will be a source that acts as a publisher. We have to tell the publisher that We are going to subscribe to you/ consume data from you. In that case, the publisher should have a method that can allow us to subscribe to it. luckily we have one method in publisher and it is called subscribe which can take subscriber as an argument.

public interface Publisher<T> {
void subscribe<Subsriber<? super T> var1);
}

Hence our subscriber will call this method in the publisher to tell it that our subscriber is willing to subscribe to you.

Our publisher also needs to tell the subscriber, you subscribed here it is your subscription.

Hence The Subscribe should have some mechanism to receive the subscription. Yes, the Subscriber has a method for that This method takes the subscription as a method parameter. basically, when the publisher calls this…

--

--

No responses yet