Does anyone know if the new <DI feature> introduce...
# arrow
k
Does anyone know if the new DI feature introduced in Ktor 3.2.0 will replace the need for using Arrows SuspendApp with Ktor lib?
s
Hi @Kjartan, You can already achieve the same today without 3.2.0, it was not explicitly mentioned in the release post but some fixes related to Structured Concurrency during graceful shutdown now allow to achieve the same as SuspendApp fixes. You can also achieve the same with Koin. but Ktor's DI will also allow it. SuspendApp is still useful, with or without Ktor but if you want to get rid of SuspendApp then I can help you figure it out ☺️ I have a couple of examples on my personal github as well.
thank you color 1
Do you think a document about this use-case, graceful shutdown and closing dependencies is missing from the Ktor website?
k
The example in release notes was nice with an example of using
cleanup
and was what lead me to this question. I'm currently using SuspendApp and it has worked nice, but with the new DI features in Ktor I was thinking about doing some refactoring towards using Ktor DI. I think it would be great with an update of the Ktor doc too, haven't looked too closely there yet, just read the release notes and got curious 🙂