Nested Transactions - already being used in a parent transaction

Hi,

I’m having trouble with nested transactions. In my example all the adapters use the same JDBC connection, which is one of type “Local Transaction”.

I have 2 Flow Services:

  • Flow Master
  • Flow Nested


Flow Master

FONT=Times New Roman[/font]
(Success Sequence)
(Failure Sequence)
Adapter Call – Simple Insert (using LocalTransaction A)
Call to another Flow Service (Flow Nested)
(Commit Transaction)
(Done Sequence)
GetLastError
(RollBack Transaction)
Exit Flow Signaling Failure

Flow Nested

FONT=Times New Roman[/font]
(Success Sequence)
(Failure Sequence)
Adapter Call – Another Simple Insert (using LocalTransaction A)
(Commit Transaction)
(Done Sequence)
GetLastError
(RollBack Transaction)
Exit Flow Signaling Failure

Error:

2009-08-11 08:22:47 AST [ART.0114.1007E] Adapter Runtime: Error Logged. See Error log for details. Error: [ART.117.4002] Adapter Runtime (Adapter Service): Unable to invoke adapter service Pruebas:adpNested.
[ART.117.4011] Adapter Runtime (Adapter Service): Unable to connect to resource mpIntCommonTW.conexiones:interwm. The resource is already being used in a parent transaction.

I’m using:

Product

webMethods Integration Server

Version

7.1.1.0

Updates

IS_7-1-1_Audit_Fix1
IS_7-1-1_WebSvcsXML_Fix14
IS_7-1-1_Core_Fix13
IS_7-1-1_XA_Fix3
IS_7-1-1_SrvPrtcl_Fix16
IS_7-1-1_FlatFile_Fix5
PRT_7-1-1_Fix2
IS_7-1-1_PubSub_Fix4
IS_7-1-1_JMS_Fix3

Build Number

134

SSL

Strong (128-bit)


What can be happening?

Thanks,


Hi,
Here the problem is the transaction is open in the parent service which is not closed before opening the another transaction in the Flow Nested .
To resolve this you can change the logic as below

by handeling the transaction only in Flow Master;

Flow Master

FONT=Times New Roman[/font]
(Success Sequence)
(Failure Sequence)
Adapter Call – Simple Insert (using LocalTransaction A)
Call to another Flow Service (Flow Nested)
(Commit Transaction)
(Done Sequence)
GetLastError
(RollBack Transaction)
Exit Flow Signaling Failure

Flow Nested

(Success Sequence)
(Failure Sequence)
Adapter Call – Another Simple Insert (using LocalTransaction A)
(Done Sequence)
GetLastError
(RollBack Transaction)
Exit Flow Signaling Failure

Let me know if this resolves ur issue.

Cheers,
Samrit

Hi,

I was looking at the documentation “6-5_JDBC_Adapter_Users_Guide.pdf” and in the transaction section it specified the following:

A new explicit transaction context can be started within a transaction context, provided that you ensure that the transactions within the transaction context are completed in the reverse order they were started—that is, the last transaction to start should be the first transaction to complete, and so forth.

For example, consider the following is a valid construct:

pub.art.transaction:startTransaction
—>pub.art.transaction:startTransaction
------->pub.art.transaction:startTransaction
------->pub.art.transaction:commitTransaction
—>pub.art.transaction:commitTransaction
pub.art.transaction:commitTransaction

So it seems possible to call the nested transaction

Any idea why the error is appearing?

Yes you can nest transactions. Make sure you didn’t try and name the transaction and also make sure you are not trying to step through it.

It seems that nested transactions as the documentation explains are allowed. The only catch is that:

Nested transaction can be done, only if, the nested transactions do not have any service adapters that use the same connection that a parent transaction already use.

If the adapter of the nested transaction uses the same connection the following error will appear.

2009-08-11 08:22:47 AST [ART.0114.1007E] Adapter Runtime: Error Logged. See Error log for details. Error: [ART.117.4002] Adapter Runtime (Adapter Service): Unable to invoke adapter service Pruebas:adpNested.
[ART.117.4011] Adapter Runtime (Adapter Service): Unable to connect to resource mpIntCommonTW.conexiones:interwm. The resource is already being used in a parent transaction.

Pass the transactionName from the parent to the child, so the child can use it in its own startTransaction call, and see what that does.