cancel
Showing results for 
Search instead for 
Did you mean: 

DataSourceTransactionManager or JTATransactionManager

rangoo
Champ in-the-making
Champ in-the-making
I have 3 applications using same activiti datasource. Each App doing different things though

1st App - Reads JMS and triggers workflows
2nd App - Continues Async WorkFlows
3rd App - REST API

I am currently using datasourcetransactionmanager.

<bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
    <property name="dataSource" ref="dataSource" />
  </bean>
 
  <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
    <property name="dataSource" ref="dataSource" />
    <property name="transactionManager" ref="transactionManager" />
    <property name="databaseSchemaUpdate" value="true" />
    <property name="jobExecutorActivate" value="false" />
  </bean>

I guess in this case Spring creates 3 transaction Managers but the Connection pool is the same.  Wondering If I should use jtaTransactionManager and leave it to the App server so that single transaction manager takes care of all transactions. Suggestions?
4 REPLIES 4

frederikherema1
Star Contributor
Star Contributor
If you're using spring, we wrap the datasource in a TransactionAwareDatasourceProxy (if not already of that instance) to make sure Activiti used the same transaction. If you use the same transactionManager instance for all of your apps (see platformTransactionManger property on SpringProcessEngineCOnfiguration), this will work without a problem, using only ONE transaction. This only works, of course, if you're in the same spring-context.

Not really sure if your apps reference each other - eg. a transactional service is called from within the execution of a service-task. If so, and the Datasource is the same JTA won't be more usefull as just using the same "PlatformTransactionManager", as no datasources need to be synchronised. If the apps do NOT reference each other, there is no need for a single transactiobn-manager, as the transactions will never be mixed work from multiple apps.

rangoo
Champ in-the-making
Champ in-the-making
Just to clarify - All 3 apps are independent use their own spring-context so they use 3 TransactionManagers (all of type datasourcetransactionmanager) pointing to same Activiti Datasource(with Global Transaction being disabled & one phase commit enabled). Do you still think there will be no issues using datasourcetransactionmanager?

trademak
Star Contributor
Star Contributor
Each app will perform its action against Activiti in its own transaction. So don't think there will be an issue with this approach technically. You only need to be aware that each app will perform its logic against Activiti in a separate transaction. Also when multiple apps access the same process instance at the same time, only one will win and the other one will get an exception.

Best regards,

rangoo
Champ in-the-making
Champ in-the-making
Thanks both of you guys.