This interface is where the action happens. The following methods have names that are self-describing:
public interface Subscriber<T>
{ public void onSubscribe(Subscription s); public void onNext(T t); public void onError(Throwable t); public void onComplete(); }
With each of the previously mentioned methods, you can register a callback that will be invoked under the appropriate circumstances, as follows:
- onSubscribe: This method is executed when the subscription process happens
- onNext: This method is executed when a new event is received
- onError: This method is executed when an error occurs
- onComplete: This method is executed when the producer has finished and there are no more results to receive