Distributed (XA) Transactions

Hi guys,
does the process engine support distributed transactions?
My goal is to access a messaging system in the same transaction as the one the engine uses.

Thanks in advance for your comments,
Thorsten

Hi Thorsten,
I use atomikos to combine a jndi datasource (from a shared process engine config) with jdbc transactions (spring). You can use atomikos for jms connections as well.
Best regards, Torsten

Hi Thorsten.

It also works out-of-the-box in Java EE containers (e.g. the WildFly distribution on the download page).

Cheers
Bernd

Though atomikos looks good - I found some great information provided at their web-site…

However, Camunda offers both transaction manager integration and support for BPMN transaction subprocess.

Business transactions lean towards long durations (hours, days, weeks, etc). And, you may encounter problem(s) associated with an XA transaction rollback within the business-context (logical) of an in-flight process instance.

Extending the context (XA) of a Camunda-system transaction into the SOA stack may lead to unintended rollbacks as the persistence infrastructure leaves dependencies hanging without viable references. This situation is further complicated with clustered-server configurations.

Forgot to add…

Camunda uses optimistic locking. And, mixing an optimistic lock in-context to a distributed XA transaction gets complicated. The Camunda engineers can step-in if I’m misinterpreting their architecture… But, imagine a Camunda ‘optimistic’ lock issuing a commit into a set of XA-managed resources. Though the business-transaction (BPMN) hasn’t yet completed, the XA-context thinks it is and moves forward with a “vote-ready” and “commit” across associated resources within the integrated SOA stack (I’m thinking about service or automation tasks).

Given the different natures/requirements between business and XA transaction requirements, we model the “transacted sub-process” with compensation events. And, we don’t mix the logical and XA domains.

Hi Bernd,
do I need a JEE based web application or does it also work in a Spring based web application (ServletProcessApplication) on Wildfly?

Hi Torsten,
thanks for the hint about atomikos. I will have a look at it.

Use the EjbProcessApplication (but this is actually quite a minimal change, you basically just have to replace the ProcessApplication class).

Hi Bernd,
I should use the EjbProcessApplication in the Spring application?
Is there any sample code for that?
With EjbProcessApplication I get the following error:
Unknown property used in expression: ${messageSender.execute()}. Cause: Cannot resolve identifier 'messageSender'
messageSender is a Spring bean. Seems like the process application can’t access the Spring application context.

The EjbProcessApplication does not connect the bean resolving to spring. The reasoning behind is that we typically see CDI being used in Java EE architectures.

That’s said it is possible to run JTA & Spring together. As doing that rarely I don’t recall the better approach from my head at the moment, so you might check the annotations and sources of the EjbProcessApplication if you can apply them to the SpringProcessApplication or teach Spring via different means to take part in Java EE correctly. Our you might use EjbPA and connect Spring bean resolving. Sorry - but currently travelling with limited time. If you have a enterprise subscription feel free to open a ticket, support can help you here!

Cheers
Bernd

Ok, thanks for the replies!