Hello, does anybody know if ktor offer a feature s...
# ktor
g
Hello, does anybody know if ktor offer a feature similar to Spring Events Publisher. I mean, I know that you can subscribe to Ktor application events, but would be nice to know if I can throw my CustomEvent and having a custom listener that handle that event.
m
seems easy: https://ktor.io/advanced/events.html#subscribing-to-events-and-raising-them
If you want to create custom events and dispatch or raise them:
Copy code
class MySubject
val MyEventDefinition = EventDefinition<MySubject>()
monitor.raise(MyEventDefinition, MySubject())
g
thanks a lot! Totally missed that small part in the ktor docs.
👍 1
m
Guava also has a simple bus.
m
Why introduce a whole utility lib when Ktor already has this feature?