1

In the Mule documentation under the transaction management topic there is a cryptic paragraph

Mule can manage non-transactional outbound connectors. By default, an outbound connector from a non-transactional transport ignores an active transaction rather than rejecting it. In other words, the default transactional action for such connectors is no longer NONE. The example code below illustrates this behavior. Mule processes messages it receives from the VM queue synchronously and transactionally. The file transport in the code example is not transactional thus, writing to the file is not part of the transaction. However, if a message throws an exception while Mule is creating the file, Mule rolls back the transaction and reprocesses the message. This example is, in effect, a multiple resource transaction.

What does the below sentence mean, is it a typo (no longer NONE)? and if its not NONE then what is the transactional action?

In other words, the default transactional action for such connectors is no longer NONE

Also if writing into the file is not part of the transaction, then how can the transaction be rolled back if the file write fails ??

Sudarshan
  • 8,574
  • 11
  • 52
  • 74

2 Answers2

1

It's not a typo.

Previously, it used to be NONE, so the transaction was resolved independently of the outcome of the non-transactional outbound interaction. Nowadays, the transaction is not resolved, ie the non-transacted outbound endpoint doesn't commit or rollback the current transaction.

The rollback occurs because an exception is thrown, which marks the transaction as to be rolled back. When the flow terminates, the current transaction is then resolved. If it has been marked for roll back, it will be rolled-back, otherwise it will be committed.

David Dossot
  • 33,403
  • 4
  • 38
  • 72
  • Does this mean the non transacted outbound is also part of the transaction in the above example ? – Sudarshan Mar 24 '15 at 17:57
  • 1
    What do you mean by "part of the transaction"? It can't **enroll** in the transaction because it is not transactional. But the current transaction is not suspended nor resolved at its boundary, thus it has the potential to mark it as rollback if it throws an exception. – David Dossot Mar 24 '15 at 20:36
1

The above text explains the "Last Resource Gambit" transactions type where all but one of the resources are transactional. In this case, the none transactional resource should be the last one and when it throws an exception then all other transactions resources are rolled back. It is kind of fictitious transactional behavior and very effective.

More info in the "XA and the Last Resource Gambit" section of the link below: http://www.javaworld.com/article/2077963/open-source-tools/distributed-transactions-in-spring--with-and-without-xa.html

Alaa Abed
  • 181
  • 1
  • 4