Henry
05/26/2021, 12:18 AM// All db calls in this block will be executed within a transaction, on a connection held in the coroutine context
transactional {
...
}
As it stands it requires a call to a static method on application startup to initialise a tx manager which the transactional
call then uses to execute the tx. This is hard to test. I'd instead like to inject a transaction manager into a parent coroutine context so it's available everywhere in the app without needing to initialise it via a static method. I looked at using a feature that intercepts the application pipeline to do this but I don't think it does what I need. Any ideas?Rustam Siniukov
05/26/2021, 1:17 PMembeddedServer
, you can pass parentCoroutineContext
as parameter. But it’s not possible with EngineMain
currently. I created a ticket for this https://youtrack.jetbrains.com/issue/KTOR-2733Henry
05/26/2021, 10:57 PM