AnsweredAssumed Answered

Async service tasks on clustered applications

Question asked by victor1 on Jul 24, 2015
Latest reply on Jul 28, 2015 by jbarrez

I have 2 applications running on the same database.
Both of them start processes like this:

for (i = 0; i < msgNbr; i++) {
   Map<String, Object> dataMap = Data.prepareData(testOptions);
   runtimeService.startProcessInstanceByKey("asyncTransferProcess", dataMap);

First service task in process is async:

<serviceTask id="serviceTask1" name="ServiceTask1" activiti:exclusive="true"

Async executors configuration:

<property name="asyncExecutor" ref="asyncExecutor" />
<property name="asyncExecutorEnabled" value="true" />
<property name="asyncExecutorActivate" value="true" />

<bean id="asyncExecutor" class="org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor">
    <property name="corePoolSize" value="20" />
    <property name="maxPoolSize" value="50" />
    <property name="keepAliveTime" value="3000" />
    <property name="queueSize" value="200" />
    <property name="maxTimerJobsPerAcquisition" value="2" />
    <property name="maxAsyncJobsDuePerAcquisition" value="2" />
    <property name="defaultAsyncJobAcquireWaitTimeInMillis" value="1000" />
    <property name="defaultTimerJobAcquireWaitTimeInMillis" value="1000" />
    <property name="timerLockTimeInMillis" value="60000" />
    <property name="asyncJobLockTimeInMillis" value="60000" />

The problem is that i get ActivitiOptimisticLockingException when applications try to run processes.
Exception in thread "pool-1-thread-15" org.activiti.engine.ActivitiOptimisticLockingException: JobEntity [id=347615] was updated by another transaction concurrently

Is there any hint how to run several apps with async processes on same DB?