A new issue has been created in the Ktor Issue Tra...
# ktor
n
A new issue has been created in the Ktor Issue Tracker on missing lifecycle APIs: https://youtrack.jetbrains.com/issue/KTOR-4704/Missing-Lifecycle-APIs-For-Ktor-Server
s
I’ve actually been working on something specifically for Ktor but it’s leveraging structured concurrency instead. I’m still in the process of writing documentation today, and will make a first stable release this week. https://github.com/arrow-kt/suspendapp There is several ways to leverage it, but together with this ticket it would be really nice since it would allow you to leverage the
emebeddedServer
on the
CoroutineScope
and it will cancel/shutdown gracefully on `SIGINT`/`SIGTERM` etc. Not just playing nice in the terminal, but also playing nice with Kubernetes and containers etc. https://youtrack.jetbrains.com/issue/KTOR-4427/CoroutineScopeembeddedServer-graceful-shutdown
You can also use abstraction such as
Resource
and reason about graceful shutdown in terms of structured concurrency. It’s being developed outside of the Ktor context, since it’s also interesting to use in combination with for example Kafka streaming if you want to guarantee offsets being committed before shutdown on
SIGINT
or another shutdown signal.
You can already try the
alpha
release which is published on Maven Central.