Tomcat Shared Engine And Transaction Management (Distributed-XA)


#1

Hello all,
I have some misunderstanding or maybe I made something incorrect but transaction management is not working correctly.

My env:

  1. Apacehe tomcat (9.0.19) with shared engine configuration. Database configs looks like:

<Resource name=“jdbc/ProcessEngine”
auth=“Container”
type=“javax.sql.XADataSource”
factory=“org.apache.tomcat.jdbc.pool.DataSourceFactory”
uniqueResourceName=“process-engine”
driverClassName=“oracle.jdbc.xa.client.OracleXADataSource”
url=“jdbc:oracle:thin:@192.9.200.130:1521:str”
defaultTransactionIsolation=“READ_COMMITTED”
username="camunda"aa
password=“camunda123”
maxActive=“20”
minIdle=“5”
maxIdle=“20” />

<Resource name="global/camunda-bpm-platform/process-engine/ProcessEngineService!org.camunda.bpm.ProcessEngineService" auth="Container"
          type="org.camunda.bpm.ProcessEngineService"
          description="camunda BPM platform Process Engine Service"
          factory="org.camunda.bpm.container.impl.jndi.ProcessEngineServiceObjectFactory" />
          
<Resource name="global/camunda-bpm-platform/process-engine/ProcessApplicationService!org.camunda.bpm.ProcessApplicationService" auth="Container"
          type="org.camunda.bpm.ProcessApplicationService"
          description="camunda BPM platform Process Application Service"
          factory="org.camunda.bpm.container.impl.jndi.ProcessApplicationServiceObjectFactory" />

Also I have multiple spring web (war) application, each of them uses multiple databases. (Oracle, Ms SQL Server, etc.) , we require distributed transaction management, so we decide to use Atomicos for implementing XA transaction management.

When I had Spring boot Application with Camunda Engine, everything was perfect. All database configuration (including camunda database) was under Atomicos XA configs. So when I had some error on BPMN side or into application side all the db actions were in 1 transaction. everything was committed or rollbacked.

Now with many reasons we decide to use shared process engine. we have 1 tomcat and and more then 10 deployed camunda bpmn web application (spring web app).

All of them are configured with atomicos to access differenet database.

I have just simple business process.
1 diagram with 3 consecutive call activity, all of them call’s 1 sub process. where I have 3 user task. user task will be created depend on which call activity is called. First call activity create first user task etc…

I have task listeners on every task create and complete., each task complete makes some logs into my database tables.

First user tasks made log into database, after completion when system is trying to complete first task and creates second one - My system throws an error into task creation listener.

all the camunda db actions rolled back. but my log into table do not.

Here is attached my process example.
diagram_1 diagram_2

Every user task has Delegates on Create and Complete events.
Every complete logs into my database.
Every create check some parameters and throw error or leave it if everything is correct.

It I throw an error into second tasks delegate , camunda rolls back task creation, also rolls back first task completion. but my log into my table is not, which was made into first task’s complete delegate.

I think configuration into tomcat side must be handled under transaction manager ( for example Atomicos). Am I right ?

If I had used wildfly with camunda does this problem will be resolved. I know that JBoss is good to use for enterprise applications ( it also includes transaction Manager (JBossTM), which supports XA transactions also.)

Any idea will be appreciated.

Best Regards,
Paata.