Chaining multiple suspended transactions
- Dominant language
- Kotlin
- Stars
- 9.3k
- Forks
- 798
- Avg merge
- 4d 2h
- Merged PRs (30d)
- 26
Description
Hi,
I have a service that opens a newSuspendedTransaction() at the top level. Thereafter, there are numerous calls across multiple service and DAOs that open their own transactions.
If I want to commit or rollback across all these services and DAOs, at the top level service that initiated the chain, how do I go about doing that?
I'm essentially looking for transaction propagation.
```
newSuspendedTransaction {
suspendedTransaction {
commit()
}
suspendedTransaction {
commit()
}
....
rollback()
}
```
The above code works. That is, the last rollback() at the top level transaction, rolls back all the child transactions.
But my problem is that all the code that forms the child suspended transactions are not available in one block, in one method.
They are dispersed/delegated across several services and DAOs. How do I go about having transactions in those child services and DAOs "participate" in the parent transaction?
The entire chain uses suspend functions.
Are there any examples of this?
Thanks.
Contributor guide
Assessment
This issue has not been assessed yet.