- Hands-On Spring Security 5 for Reactive Applications
- Tomcy John
- 88字
- 2021-07-23 18:59:13
The Subscriber Interface
The definition of this interface is as follows:
public interface Subscriber<T> {
public void onSubscribe(Subscription s);
public void onNext(T t);
public void onError(Throwable t);
public void onComplete();
}
As you can see, the Subscriber interface's onSubscribe method allows Subscriber to be notified when Publisher accepts the Subscription. The onNext method is invoked when new items get published. As the name suggests, the onError method is invoked when there's an error and the onComplete method gets invoked when Publisher has completed its function.