https://kotlinlang.org logo
#ktor
Title
# ktor
m

Marcin Wisniowski

03/08/2023, 6:29 PM
I'm trying to migrate my custom Feature into the new Plugin API, but I can't find what is the new equivalent of:
Copy code
pipeline.environment.monitor.subscribe(Routing.RoutingCallStarted) { it: RoutingApplicationCall
    it.route[..]
}
Where should I look?
The crucial part being that I need the
RoutingApplicationCall
, not an
ApplicationCall
like all the new
onCall
etc. methods are providing.
All right, looks like looking for a new API was my mistake, it's exactly the same except you can access
environment
directly from
PluginBuilder
block.
r

Rustam Siniukov

03/09/2023, 10:56 AM
you can use
on(MonitoringEvent(Routing.RoutingCallStarted)) { ... }
hook
m

Marcin Wisniowski

03/09/2023, 6:57 PM
Thank you, I think the docs are a little confusing on this one. In https://ktor.io/docs/custom-plugins.html#other it says:
There is also the
MonitoringEvent
hook that allows you to handle application events, such as application startup or shutdown.
which made me think MonitoringEvent is only for application-level events. All the examples given in the linked page also are application-level events. So it's not clear that MonitoringEvent can be used for call-level events, and where would one discover what possible events exist.
3 Views