Hey folks :wave: Quick question on the new `createApplicationPlugin` API. More info in :thread:.
m
Hey folks ๐Ÿ‘‹ Quick question on the new
createApplicationPlugin
API. More info in ๐Ÿงต.
We currently have an interceptor in our ktor server that merges custom context data (if any) into the CoroutineContext on
ApplicationCallPipeline.Setup
.
Copy code
pipeline.intercept(customContextPhase) {
    val context = genContext(call)

    if (context != null) {
        withContext(context) {
            proceed()
        }
    } else {
        proceed()
    }
}
Since
withContext()
and
proceed()
are both not directly available to us in
createApplicationPlugin
's scope, do you have any recommendations on a way to achieve this same functionality? Or should we just stick with a pipeline interceptor in this case?
We did successfully create a custom
Hook
that basically does what this interceptor does. But this didn't feel quite right, as the hook ends up doing the plugin's heavy lifting.
a
I think itโ€™s OK to write a hook when you need low-level control over the execution.
๐Ÿ™ 1