In any given implementation of reactive programming, we will have a Subscriber that requests data and a Publisher that provides the data. Let's first look at a sample Subscriber implementation:
import java.util.concurrent.Flow.*; public class packtSubscriber<T> implements Subscriber<T> { private Subscription theSubscription; // We will override the four Subscriber interface methods @Override public void onComplete() { System.out.println("Data stream ended"); } @Override public void onError(Throwable theError) { theError.printStackTrace(); } @Override public void onNext(T theItem) { System.out.println("Next item received: " + theItem); theSubscription.request(19); // arbitrary number for example purposes } @Override ...