aiq.utils.reactive.base.subject_base#

Attributes#

Classes#

SubjectBase

Minimal interface we expect from the Subject for unsubscribing logic.

Module Contents#

T#
OnNext#
OnError#
OnComplete#
class SubjectBase#

Bases: aiq.utils.reactive.base.observer_base.ObserverBase[T], aiq.utils.reactive.base.observable_base.ObservableBase[T]

Minimal interface we expect from the Subject for unsubscribing logic.

abstractmethod _unsubscribe_observer(observer: object) None#
abstractmethod subscribe(
on_next: aiq.utils.reactive.base.observer_base.ObserverBase[T] | OnNext[T] | None = None,
on_error: OnError | None = None,
on_complete: OnComplete | None = None,
) aiq.utils.reactive.subscription.Subscription#

Subscribes an Observer or callbacks to this Observable.

If an Observer is provided, it will be subscribed to this Observable. If callbacks are provided, they will be wrapped into an Observer and subscribed to this Observable.

abstractmethod on_next(value: T) None#

Called when a new item is produced. If the observer is stopped, this call should be ignored or raise an error.

abstractmethod on_error(exc: Exception) None#

Called when the producer signals an unrecoverable error. After this call, the observer is stopped.

abstractmethod on_complete() None#

Called when the producer signals completion (no more items). After this call, the observer is stopped.