Process defined using Model API - every-time deployment, even with no changes

I use Model API to define process and I faced with problem that process is deployed every time, even if its definition was not changed.

As I can see resolving resources to deploy, also due to their potential changes is implemented here:

This method use also another method
which compares two XML process definitions - existing, and new (potentially the same as existing). But when these XMLs are generated by Model API, all element ids are generated on the fly and are different for every single deploy of the same process definition - e.g.

<bpmndi:BPMNDiagram id="BPMNDiagram_316dd423-39b4-4eb3-a4aa-2dde2c43152a">
<bpmndi:BPMNShape bpmnElement="..." id="BPMNShape_99f63448-ae44-4d4a-a315-f42d253188a9">

Hence, every generated process definition XML by Model API is different from previous and is deployed every time.

Deployment realisation in my code:

    .addModelInstance("shop.bpmn", modelInstance)

Does anyone know how to handle it?

Camunda v. 7.11

@fattdamon You need to set deployChangedOnly=true

I think I set up it already by calling


from sources:

   * Check the resources for duplicates in the set of previous deployments with
   * same deployment source. If no resources have changed in this deployment,
   * its contained resources are not deployed at all. For further configuration,
   * use the parameter <code>deployChangedOnly</code>.
   * @param deployChangedOnly determines whether only those resources should be
   * deployed that have changed from the previous versions of the deployment.
   * If false, all of the resources are re-deployed if any resource differs.
  DeploymentBuilder enableDuplicateFiltering(boolean deployChangedOnly);

Hi @fattdamon,

you can set the element ids explicitly to a fixed value. Have a look in the example code here:, especially in the createElementcreateElement(BpmnModelElementInstance parentElement, String id, Class<T> elementClass) method.

This would generate an identical model everytime and it will be filtered as duplicate.

Hope this helps, Ingo

1 Like