I'm trying to migrate my custom Feature into the n...
# ktor
m
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
you can use
on(MonitoringEvent(Routing.RoutingCallStarted)) { ... }
hook
m
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.