Camunda always creates a new deployment even with deploy-changed-only = true

I am using Camunda 7 (standalone engine).

I have a separate Spring Boot application that deploys BPMN files to Camunda using a Feign client and the REST API:

POST /engine-rest/deployment/create

I am sending the following flags correctly:

  • enable-duplicate-filtering = true

  • deploy-changed-only = true

The following values are constant and unchanged between deployments:

  • deployment-name

  • deployment-source

  • tenant-id

  • BPMN file name

  • BPMN file content (no changes at all)

However, Camunda always creates a new deployment, even when the BPMN file has not changed.


What works

When I call the Camunda REST API directly via Postman / curl, duplicate filtering works correctly and no new deployment is created if the file is unchanged.


What fails

When I deploy programmatically from my application using Feign + MultipartFile, Camunda always treats the deployment as new.


Relevant code (simplified)

Feign client

@PostMapping(
    value = "/deployment/create",
    consumes = MediaType.MULTIPART_FORM_DATA_VALUE
)
ResponseEntity<Void> createDeployment(
    @RequestPart("tenant-id") String tenantId,
    @RequestPart("deployment-name") String deploymentName,
    @RequestPart("deployment-source") String deploymentSource,
    @RequestPart("enable-duplicate-filtering") Boolean enableDuplicateFiltering,
    @RequestPart("deploy-changed-only") Boolean deployChangedOnly,
    @RequestPart("data") MultipartFile file
);


Reading BPMN from classpath and sending it

byte[] bytes = resource.getInputStream().readAllBytes();

MultipartFile multipartFile = new MockMultipartFile(
    "data",
    resource.getFilename(),
    MediaType.APPLICATION_OCTET_STREAM_VALUE,
    bytes
);

workflowEngine.createDeployment(multipartFile, tenantId);


Observed behavior in Camunda logs

Camunda always executes:

ENGINE-13001 Creating new deployment
ENGINE-13019 Processing resource <file>.bpmn

And the SQL query for latest resources returns no previous resources, so duplicate filtering never matches.

and in DB i check the act_ge_bytearray.bytes_ for two different deployement and are same


Question

Why does Camunda not detect the resource as unchanged when deploying via REST / Feign + MultipartFile?

Is there any known issue or requirement regarding:

  • Multipart form data

  • Resource name vs filename

  • InputStream / byte handling

  • Deployment source or deployment name

  • Feign or Spring MockMultipartFile

What is the correct way to send BPMN files programmatically so that deploy-changed-only works as expected?


@Niall
I found the issue it be duplicated on tenants, the query should have a condition by tenant id.

i create 2 deployement:
d1 β†’ tenant A
d2 β†’ tenant B

when i redeploy them in same order the LAST_RESOURCE will be d2 (tenant B) so this condition always will be false and D.TENANT_ID_ = 'A'

select

	*

from

	ACT_GE_BYTEARRAY B

inner join (

	select

		B.NAME_,

		MAX(D.DEPLOY_TIME_) DEPLOY_TIME_

	from

		ACT_GE_BYTEARRAY B

	inner join ACT_RE_DEPLOYMENT D on

		B.DEPLOYMENT_ID_ = D.ID_

	where
                -- should add condition by tenant id

		D.NAME_ = 'maker-checker.bpmn'

		and D.SOURCE_ = 'INTERNAL'

		and B.NAME_ in ('maker-checker.bpmn')

	group by

		B.NAME_) LAST_RESOURCE on

	B.NAME_ = LAST_RESOURCE.NAME_

inner join ACT_RE_DEPLOYMENT D on

	B.DEPLOYMENT_ID_ = D.ID_

	and D.DEPLOY_TIME_ = LAST_RESOURCE.DEPLOY_TIME_

	and D.NAME_ = 'maker-checker.bpmn'

	and D.SOURCE_ = 'INTERNAL'

	and D.TENANT_ID_ = 'A'

order by

	B.ID_ asc
1 Like

Thank you for the explanation, but I can’t follow it. Is the SQL you copied the one to retrieve the last stage of the model? Why would it deliver a changed state for the (e.g.) tenant A?

1 Like

I get the sql from logs to check why every deployment create a new one, it is print when fire create deployment api then print

ENGINE-13001 Creating new deployment
ENGINE-13019 Processing resource .bpmn

I have multi tenants and each tenant has a bulk of processes and i deploy them when application start automatically.
So if i rerun the application (without change any process) should not create a new deployment for each tenant.

2 Likes