ApplicationEventBus class abstract
Defines the contract for an event multicaster that manages the registration,
removal, and dispatching of ApplicationEvent
s to ApplicationListener
s.
Implementations of this interface are responsible for:
- Keeping track of registered listeners and listener pods (by name).
- Notifying the appropriate listeners when an event is published.
- Supporting listener removal by predicate or name.
Example Usage
final multicaster = MyApplicationEventMulticaster();
multicaster.addApplicationListener(MyCustomListener());
multicaster.addApplicationListenerPod('loggingListener');
multicaster.multicastEvent(SomeCustomEvent());
multicaster.removeApplicationListeners((listener) => listener is MyCustomListener);
This interface is typically implemented within the JetLeaf application context to provide event publication support across the system.
Constructors
- ApplicationEventBus()
-
Defines the contract for an event multicaster that manages the registration,
removal, and dispatching of
ApplicationEvent
s toApplicationListener
s.
Properties
- hashCode → int
-
The hash code for this object.
no setterinherited
- runtimeType → Type
-
A representation of the runtime type of the object.
no setterinherited
Methods
-
addApplicationListener(
{ApplicationEventListener< ApplicationEvent> ? listener, String? podName}) → Future<void> -
Adds an
ApplicationListener
instance to the event multicaster or use podName to let Jetleaf lazily resolve the listener by pod name and fetch its instance. -
noSuchMethod(
Invocation invocation) → dynamic -
Invoked when a nonexistent method or property is accessed.
inherited
-
onEvent(
ApplicationEvent event) → Future< void> -
Broadcasts the given
event
to all appropriate listeners. -
removeAllListeners(
) → Future< void> - Removes all listeners, both instances and pods, from the multicaster.
-
removeApplicationListener(
{ApplicationEventListener< ApplicationEvent> ? listener, String? podName}) → Future<void> -
Removes a previously registered
ApplicationListener
instance or use podName to let Jetleaf lazily resolve the listener by pod name and remove its instance. -
removeApplicationListeners(
{Predicate< ApplicationEventListener< ? listener, Predicate<ApplicationEvent> >String> ? podName}) → Future<void> -
Removes all registered
ApplicationListener
instances that match the providedlistener
or pods by name that match the providedpodName
. -
toString(
) → String -
A string representation of this object.
inherited
Operators
-
operator ==(
Object other) → bool -
The equality operator.
inherited