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

Dariusz Kuc

02/07/2023, 9:01 PM
hello 👋 is it possible to inject plugin to a specific order in the pipeline? i.e. I'm writing a plugin that automatically configures
ContentNegotiation
and
Routing
plugins so was wondering what would be the order of execution if users specify another plugin (e.g. CORS) current flow
<request> --> ContentNegotiation --> Routing --> [my plugin app logic] -> <response>
expected usage
Copy code
fun Application.myModule() {
    install(MyPlugin) { // configuration }
}
Guessing the plugin execution order is implied by the code order but just want to double check, e.g.
Copy code
fun Application.myModule() {
    install(CORS) // runs before my plugin
    install(MyPlugin) { // configuration }
    install(Foo) // can process response of my plugin
}
a

Aleksei Tirman [JB]

02/08/2023, 7:36 AM
The order of execution depends on what phases in what pipelines plugins intercept. Only if plugins intercept the same phase in the same pipeline, the order is determined by the order of
install
calls.
4 Views