AnsweredAssumed Answered

Activiti issues autodeploying, duplicated processes

Question asked by maqjav on Sep 8, 2017

Hello.

 

I'm testing Activiti to use it in a new project.

I have 1 app with a process that contains 1 cron job and 2 tasks.

I'm using Spring autodeploy, so my diagram is contained in the app WAR.

If I deploy this WAR in 2 servers (emulating a clustered environment), I notice that the process is deployed twice, and I can see in my database 2 process with version 1 and version 2.

 

The first server is launching the job using the process version 1, and the second server is launching the job using the process version 2. Of course, we don't want this to happend, the process should be running only once.

 

This is my Spring configuration:

 

<bean id="processEngineConfiguration" class="org.activiti.spring.SpringProcessEngineConfiguration">
<property name="dataSource" ref="dataSourcePool" />
<property name="transactionManager" ref="transactionManager" />
<property name="databaseSchemaUpdate" value="true" />
<property name="history" value="audit"/>
<property name="asyncExecutorActivate" value="true" />
<property name="deploymentResources" value="classpath*:diagrams/*.bpmn" />
</bean>

 

And this is my Test.bpmn deployed in both WAR:

 

<process id="myProcess" name="My process" isExecutable="true">
<startEvent id="timerstartevent1" name="Timer start">
<timerEventDefinition>
<timeCycle>0 0/1 * * * ?</timeCycle>
</timerEventDefinition>
</startEvent>
<serviceTask id="servicetask1" name="Service Task" activiti:class="test.Task1"></serviceTask>
<sequenceFlow id="flow1" sourceRef="timerstartevent1" targetRef="servicetask1"></sequenceFlow>
<serviceTask id="servicetask2" name="Service Task" activiti:class="test.Task2"></serviceTask>
<sequenceFlow id="flow2" sourceRef="servicetask1" targetRef="servicetask2"></sequenceFlow>
<endEvent id="endevent1" name="End"></endEvent>
<sequenceFlow id="flow3" sourceRef="servicetask2" targetRef="endevent1"></sequenceFlow>
</process>

 

We have notice that if we restart the project, the process is deployed again with a newer version.

 

Shouldn't activiti internally avoid this behaviour? Am I doing something wrong?

 

Thanks.

Outcomes