Using Spring Boot Camunda engine and storing BPMN process files with code repository

Hi,
I am using Spring Boot to run the Camunda engine. I have seen that bpmn files added to the resources folder gets deployed automatically.

I want to use the resources folder to persist my BPMN files with the code so that whenever I update or add a new BPMN file then that gets deployed automatically at the time of deployment.

First I observed that bpmn file is getting deployed with every start of the Spring boot Application and the version for that process was incrementing. But I realize that it is happening only if I re-save the bpmn file or make small changes (even though there is no actual change in the process). I hope my guess is correct and the same file will not get deployed every time with a new version. Please confirm this.

Another question is; if I use a MySQL DB and run 2 instances of my Spring Boot Camunda service (connected to the same MYSQL DB) then there will not be any race condition for deploying the same bpmn from both instances. I hope only one version will get deployed. Please confirm this.

1 Like

Hi @Himanshu_Singh,

That is correct. While deploying (every restart), the engine compares the bpmn file with content of the database by String.equals(). In case of a difference a new version is created. And also a change in the coordiates of elements on the canvas are part of the BPMN file. In case of more than one BPMN file in your project, by default a change in a single diagram will increase the version for all process definitions. It can be controlled with isDeployChangedOnly: Process Archive Configuration | docs.camunda.org.

You can check the details here: Deployments | docs.camunda.org

Hope this helps, Ingo

1 Like

Thanks, Richtsmeier!
That is really useful information.
I hope to make isDeployChangedOnly true is ok and suggested in case we have multiple bpmn files.

I am struggling to make it work. I have tried the below processes.xml file

<process-archive name="embedded-camunda-process">
    <properties>
        <property name="isDeployChangedOnly">true</property>
    </properties>
</process-archive>

I have put this in “src/main/resources/META-INF/”, but it is not working. I can see that making changes to one bpmn file is actually updating the versions for other non-changed bpmn files.

Hi @Himanshu_Singh,

it depends if you use the @EnableProcessApplication("anyName").

If yes, this processes.xml should work:

<process-application
  xmlns="http://www.camunda.org/schema/1.0/ProcessApplication"
  xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">

  <process-archive>
    <properties>
      <property name="isDeployChangedOnly">true</property>
    </properties>
  </process-archive>

</process-application>

If not, (you use the Spring Auto deployment) you can set it in the application.yml:

camunda:
  bpm:
    generic-properties:
      properties:
        deployChangedOnly: true

Hope this helps, Ingo

4 Likes

Thanks!
Setting the property in the application.yml worked perfectly.