cancel
Showing results for 
Search instead for 
Did you mean: 

With async task how to achieve sequential order of excecution of activiti flow

pavitra
Champ in-the-making
Champ in-the-making
Hi,

I made all task of my sample activiti bpmn as async, because I have to log each step information. But I am facing issue because its aync  i.e
In Thread pool all task in the activiti executing in parallel. I wanted in sequential order. Because 2nd step depends on the 1st step data. 
Example : Start—>MainProcess1(Service task)–>MainProcess2(Service task)–>SubProcess(call activiti)–> End.
If MainProcess1 has too many calculation to takes place , execution starts in MainProcess2. It should not happen , So I wanted seqential order with async.

My process engine configuration is as follows.
<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
      <property name="dataSource" ref="dataSource" />
      <property name="transactionManager" ref="transactionManager" />
      <property name="databaseType" value="postgres" />
      <property name="databaseSchemaUpdate" value="none" />
      <property name="databaseSchema" value="schema" />
      <property name="databaseTablePrefix" value="schema." />
      <property name="jobExecutorActivate" value="false" />
      <property name="asyncExecutor" ref="asyncExecutor" />
      <property name="asyncExecutorEnabled" value="true" />
      <property name="asyncExecutorActivate" value="true" />
   </bean>

   <bean id="asyncExecutor"
      class="org.activiti.engine.impl.asyncexecutor.DefaultAsyncJobExecutor">
      <property name="corePoolSize" value="20" />
      <property name="maxPoolSize" value="500" />
      <property name="keepAliveTime" value="10000000" />
      <property name="queueSize" value="500" />
      <property name="maxTimerJobsPerAcquisition" value="1" />
      <property name="maxAsyncJobsDuePerAcquisition" value="1" />
      <property name="defaultAsyncJobAcquireWaitTimeInMillis"
         value="100000" />
      <property name="defaultTimerJobAcquireWaitTimeInMillis"
         value="100000" />
      <property name="timerLockTimeInMillis" value="6000000" />
      <property name="asyncJobLockTimeInMillis" value="6000000" />
   </bean>
   <bean id="processEngine" class="org.activiti.spring.ProcessEngineFactoryBean">
      <property name="processEngineConfiguration" ref="processEngineConfiguration" />
   </bean>

Please help on this .Thanks in advance.


2 REPLIES 2

pavitra
Champ in-the-making
Champ in-the-making
please find the attach of process engine configuration.

jbarrez
Star Contributor
Star Contributor
That's the whole point of async, things happen in parallel, unordered ….