Package io.reactivex.rxjava3.observers
package io.reactivex.rxjava3.observers
Default wrappers and implementations for observer-based consumer classes and interfaces,
including disposable and resource-tracking variants and
the
TestObserver
that allows unit testing
Observable
-, Single
-,
Maybe
- and Completable
-based flows.
Available observer variants
Reactive type | Base interface | Simple | Disposable | Resource |
Observable |
Observer |
DefaultObserver |
DisposableObserver |
DisposableObserver |
Maybe |
MaybeObserver |
N/A | DisposableMaybeObserver |
DisposableMaybeObserver |
Single |
SingleObserver |
N/A | DisposableSingleObserver |
DisposableSingleObserver |
Completable |
CompletableObserver |
N/A | DisposableCompletableObserver |
DisposableCompletableObserver |
-
ClassDescriptionBaseTestConsumer<T,
U extends BaseTestConsumer<T, U>> Base class with shared infrastructure to supportTestSubscriber
andTestObserver
.Abstract base implementation of anObserver
with support for cancelling a subscription viaDefaultObserver.cancel()
(synchronously) and callsDefaultObserver.onStart()
when the subscription happens.An abstractCompletableObserver
that allows asynchronous cancellation by implementing Disposable.An abstractMaybeObserver
that allows asynchronous cancellation by implementingDisposable
.An abstractObserver
that allows asynchronous cancellation by implementingDisposable
.An abstractSingleObserver
that allows asynchronous cancellation by implementingDisposable
.An interface that indicates that the implementing type is composed of individual components and exposes information about their behavior.An abstractCompletableObserver
that allows asynchronous cancellation of its subscription and associated resources.An abstractMaybeObserver
that allows asynchronous cancellation of its subscription and associated resources.An abstractObserver
that allows asynchronous cancellation of its subscription and associated resources.An abstractSingleObserver
that allows asynchronous cancellation of its subscription and the associated resources.SafeObserver<T>Wraps anotherObserver
and ensures allonXXX
methods conform the protocol (except the requirement for serialized access).Serializes access to theObserver.onNext(Object)
,Observer.onError(Throwable)
andObserver.onComplete()
methods of anotherObserver
.TestObserver<T>AnObserver
,MaybeObserver
,SingleObserver
andCompletableObserver
composite that can record events fromObservable
s,Maybe
s,Single
s andCompletable
s and allows making assertions about them.An observer that ignores all events and does not report errors.