Subscription

A handle returned by lambda-based EventBus.subscribe overloads.

Call cancel to remove the handler from the bus. Also implements AutoCloseable for use in try-with-resources / Kotlin use { } blocks.

val sub = bus.subscribe<TickEvent> { tick() }
// later:
sub.cancel()
Subscription sub = bus.subscribe(TickEvent.class, Priority.NORMAL, e -> tick());
// later:
sub.cancel();

Functions

Link copied to clipboard
abstract fun cancel()

Removes this handler from the bus. Idempotent; safe to call more than once.

Link copied to clipboard
open override fun close()

Alias for cancel; allows use in try-with-resources / use { }.