But now I need another service that needs to call several of these services
Main Service
1.StartTransaction (store in lVariable)
2.Try
2.1 call service A
2.2 call service B
2.3 call service C
2.4 CommitTransaction (lVariable)
3.Catch
3.1 Error Logic
3.2 RollbackTransaction (lVariable)
My issue here is that if any of the services A, B or C fails, the main service should rollback without commiting anything to the DB.
What is actually happening is that when service B fails, the main service rollbacks but changes made by A are already commited and do not rollback!
The issue is that services A, B and C can be called from CAF and require that either all logic is done or everything is rolled back. So I need commit and rollback in services A, B and C…
What I have done is to add an input variable to the A, B and C services that enable the transactions or not. This will allow the services to be called independently with transactions or by the Main service without using transactions inside.
The flow runs trough all A, B and C and the main commit returns the error:
AuditLogManager Exception: java.lang.NullPointerException
commit failed: more than 1 local trans enlisted. xid = [FormatId=45744, GlobalId=/1286811217265, BranchQual=1] rxid = {2}
delisted transaction commit failed: java.lang.IllegalStateException: commit failed. more than one local transaction enlisted. xid = /1286811217265
Adapter Runtime: Error Logged. See Error log for details. Error: [ART.114.303] Adapter Runtime (Transaction): Unable to commit transaction.
Adapter Runtime (Adapter Service): Error(s) occurred while closing adapter connections.
Are A, B and C all using the same connection pool? If not, then that’s the issue. Only one connection in a transaction can be LOCAL_TRANSACTION. The others need to be XA_TRANSACTION.