cancel
Showing results for 
Search instead for 
Did you mean: 

Independently commiting transactions

gul
Champ in-the-making
Champ in-the-making
I have an all-service-task(ST) workflow with a waitTask to force activiti to perists data( and to avoid stack overflows).    

ST1 –> ST2 –> ST3 –> ST4 –> WaitTask –> Exclusive Gateway –> (if TRUE –> End,
                                              else –> Point back to ST2)
Each of my service tasks are complex; as they persists several hundred records into database.
The problem is, the data is not committed until the process hits waitTask.  Though I am not sharing the same transaction manager.  
How can I make the transactions created by Activiti and by my service task commit independent.


<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
      <property name="dataSource" ref="dataSource" />
      <property name="transactionManager" ref="transactionManagerActiviti" />
      <property name="databaseSchemaUpdate" value="false" />
      <property name="jobExecutorActivate" value="false" />
      <property name="asyncExecutorEnabled" value="true" />
      <property name="asyncExecutorActivate" value="true" />
      <!–  Need to Validate this –>
      <property name="deploymentResources" value="classpath*:processes/activiti/*bpmn20.xml" />
</bean>                                          
<bean id="transactionManagerActiviti"   class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
      <property name="dataSource" ref="datasourceForOracle"/>      
      <property name="globalRollbackOnParticipationFailure" value="false"></property>
</bean>
<!– Transaction Manager used by service tasks–>

<bean id="transactionManager"
      class="org.springframework.jdbc.datasource.DataSourceTransactionManager">
      <property name="dataSource" ref="datasourceForOracle">
         <ref bean="$cashavailDataSource{cashavail.dataSourceBeanName}" />
      </property>      
</bean>

Invocation:

ProcessInstance pi = runtimeService.startProcessInstanceByKey("customProcess",processContextMap);
Execution execution = null;
while ((execution = runtimeService.createExecutionQuery().processInstanceId(pi.getId()).activityId("waitStateReceiveTask")
            .singleResult()) != null) {         
         runtimeService.signal(execution.getId());
}
1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

use http://activiti.org/userguide/index.html#bpmnTransactionSubprocess
or make task asynchronous - it forces transaction start.

Regards
Martin