Concept
The concept of ReactiveX is very well summarized on the official website, so it is better to read there.
The Signal class that implements the Reactive Pattern. This class provides
methods for subscribing to the Signal as well as delegate methods to the various
observers.
In Reactive Pattern an observer subscribes to a Signal. Then that observer reacts
to whatever item or sequence of items the Signal emits. This pattern facilitates
concurrent operations because it does not need to block while waiting for the
Signal
to emit objects, but instead it creates a sentry in the form of an observer that stands
ready to react appropriately at whatever future time the Signal does so.
The subscribe method is how you connect an Observer to a Signal. Your
Observer implements some subset of the following methods:
Observer#accept(Object)- ASignalcalls this method whenever theSignalemits an item. This method takes as a parameter the item emitted by theSignal.Observer#error(Throwable)- ASignalcalls this method to indicate that it has failed to generate the expected data or has encountered some other error. It will not make further calls toObserver#error(Throwable)orObserver#complete(). TheObserver#error(Throwable)method takes as its parameter an indication of what caused the error.Observer#complete()- ASignalcalls this method after it has calledObserver#accept(Object)for the final time, if it has not encountered any errors.
By the terms of the Signal contract, it may call Observer#accept(Object)
zero or more times, and then may follow those calls with a call to either
Observer#complete() or Observer#error(Throwable) but not both, which will
be its last call. By convention, in this document, calls to
Observer#accept(Object) are usually called “emissions” of items,
whereas calls to Observer#complete() or Observer#error(Throwable) are
called “notifications.”