EventBus class abstract

Implementers

Constructors

EventBus({bool isModelBus = false, ObservabilityConfig? observability})
Factory constructor for EventBus. Creates an EventBusImpl instance.
factory

Properties

allEventStream → Stream<(EventDTO, bool)>
Stream for all sent events (event DTO, and whether it had a listener or not)
no setter
errors → Stream<EventBusError>
Bus failures as data. The stream never carries stream errors.
no setter
hashCode → int
The hash code for this object.
no setterinherited
isDisposed → bool
true once dispose has been called
no setter
isModelBus → bool
no setter
isObservable → bool
True when observability is enabled for this bus.
no setter
metrics → EventBusMetrics
The metric collector of this bus. Safe to read when observability is off: the snapshot is empty in that case.
no setter
recentErrors → List<EventBusError>
The latest errors, bounded (100 entries).
no setter
runtimeType → Type
A representation of the runtime type of the object.
no setterinherited
suppressedErrors → int
Errors suppressed by the per-kind/topic rate limit.
no setter

Methods

currentData<T>(EventSelector<T> selector) → T?
The value stored for a selector: an exact key or a pattern key.
dispose() → Future<void>
Closes the all-events stream and every node of the bus. Safe to call twice. After dispose the bus is unusable: fire/request/listen/subscribe/subscribe throw StateError.
fire<T>(EventKey<T> key, T data, {Map<String, String>? arguments, String? correlationId}) → bool
Publishes data on an exact typed key.
haveAvailableHandler<T>(EventSelector<T> selector) → bool
Whether a handler for the selector could accept a request now.
haveHandler<T>(EventSelector<T> selector) → bool
Whether a selector has a handler, including paused handlers.
haveListener<T>(EventSelector<T> selector) → bool
Whether a selector has a listener.
listen<T>(EventSelector<T> selector) → Stream<T>
Listens to a typed exact or pattern selector.
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
remove<T>(EventSelector<T> selector) → bool
Removes one type node for an exact or pattern selector.
removeAddress(EventAddress address) → bool
Removes every type node registered at an exact address.
request<T>(EventKey<T> key, T data, {Map<String, String>? arguments, Duration? timeout, CancelToken? cancelToken, String? correlationId}) → Future
Sends a request on an exact typed key and waits for the handler result.
subscribe<T>(EventSelector<T> selector, {EventCallback<T>? onEvent, Handler<T>? handler, T? initialData, int handlerConcurrency = 1, int? requestQueueCapacity, int? bufferCapacity, BufferOverflow bufferOverflow = BufferOverflow.dropOldest, DeliveryMode deliveryMode = DeliveryMode.async, void onError(Object error, StackTrace? stackTrace)?, void onDone()?, bool cancelOnError = false}) → EventSubscription<T>
Creates a listener and/or handler subscription for a typed selector.
toString() → String
A string representation of this object.
inherited

Operators

operator ==(Object other) → bool
The equality operator.
inherited