AnsweredAssumed Answered

Activiti - Spring transactions

Question asked by subashini on Jun 6, 2016
Latest reply on Jun 20, 2016 by jbarrez
Activiti - Spring transactions
Unfollow this thread

I am using Activiti with Spring integration. I have configured Activiti and Spring to use transaction manager as given below:
<?xml version="1.0" encoding="UTF-8"?>
<beans xmlns=""
    <bean id="dataSource" class="org.springframework.jndi.JndiObjectFactoryBean">
    <property name="jndiName" value="jdbc/appDS"/>
    <bean id="workflowDbDAO" class="db.WorkflowDbDAOImpl">   
       <property name="dataSource" ref="dataSource" />

    <bean id="transactionManager" class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
       <property name="dataSource" ref="dataSource" />
   <bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">      
      <property name="dataSource" ref="dataSource" />
      <property name="transactionManager" ref="transactionManager" />
       <property name="databaseType" value="oracle" />
       <property name="databaseSchemaUpdate" value="true" />         
       <property name="history" value="audit" />
       <property name="jobExecutorActivate" value="true"/>             
       <property name="mailServerUseTLS" value="true" />           
   <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean" destroy-method="destroy">
     <property name="processEngineConfiguration" ref="processEngineConfiguration" />
  <bean id="repositoryService" factory-bean="processEngine" factory-method="getRepositoryService" />
  <bean id="runtimeService" factory-bean="processEngine" factory-method="getRuntimeService" />
  <bean id="taskService" factory-bean="processEngine" factory-method="getTaskService" />
  <bean id="historyService" factory-bean="processEngine" factory-method="getHistoryService" />
  <bean id="managementService" factory-bean="processEngine" factory-method="getManagementService" />
  <bean id="identityService" factory-bean="processEngine" factory-method="getIdentityService" />
I have a simple workflow as follows:
Start—>Service Task–>Mail Task—> User Task—>End

I have execution Listeners in all of the components. The execution Listeners performs insert/update to a external tables apart from Activiti Schema.

I have an exception thrown @Execution Listener in Service Task. I see that the transaction is handled in the following way:
1. Data in the Activiti Tables has been rolled back. This is as expected as a wait state was not reached. Hence the transaction roll backed.
2. The data changes to external tables have been committed instead of rollback.

I have questions for 2. Shouldn't the external DB and Activiti use the same transaction,when they use the same transaction manager? If activiti transaction is getting rollbacked, why is the data in the external tables committed, even when an exception is thrown.

Any pointers on this issue will really help me. I am stuck at this point.