You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
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.
The text was updated successfully, but these errors were encountered:
If it clarifies further, in a non-suspend world, I can open multiple transactions at various points, and the transaction always looks for currentOrNull and knows to participate in an ongoing transaction.
However in a suspend world, I cannot open a simple transaction, unless I only call non-suspend functions thereafter.
So I have to use newSuspendedTransaction to begin with, but later on I don't have an ongoing transaction to call suspendedTransaction for child transactions.
The only way I see is to actually pass the parent transaction around into every Service and DAO have them call suspendedTransaction on it. That way seems incredibly painful.
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.
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.
The text was updated successfully, but these errors were encountered: