Accessing the EventBus
The EventBus is accessible throughPluginContext:
Subscribing to events
Use thesubscribe method with the event type and a handler lambda:
Subscription options
Subscription return value
subscribe returns an EventSubscription handle with a cancel() method:
Collecting as a Flow
Events can also be observed as a coldFlow:
Waiting for a single event
Event priority
All subscriptions have aPriority level. Higher priority subscribers receive events first:
Sticky events
Sticky events are retained by the bus and immediately delivered to new subscribers. Sticky events are configured when creating the bus viaEventBusConfigBuilder.