Subscribe
Marks a method as an event handler to be discovered by an EventBus.
A valid handler must accept exactly one parameter whose type implements Event, return Unit / void, and be an instance method (for EventBus.subscribe) or a static / @JvmStatic method (for EventBus.subscribeStatic).
If a subclass overrides a handler without re-annotating it, the override is not dispatched. Always re-annotate overrides:
class Sub : Base() {
@Subscribe
override fun on(e: MyEvent) { super.on(e) }
}Content copied to clipboard
Parameters
priority
Dispatch priority; higher values fire first. Use Priority constants or any integer. Defaults to Priority.NORMAL.
async
If true, dispatches this handler on the bus's configured executor. Falls back to synchronous execution if no executor is configured. Defaults to false.