Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Camunda Process Definition Deployment via API

Tags:

camunda

I'm trying to deploy a process definition from a file using the following code

    DeploymentBuilder deploymentBuilder = repositoryService.createDeployment().name(definitionName);
    deploymentBuilder.addInputStream(definitionName, definitionFileInputStream);
    String deploymentId = deploymentBuilder.deploy().getId();
    System.out.println(deploymentId);

The above code runs successfully and the new deploymentId is printed out.

Later, I tried to list the deployed process definitions using the following code

    List<ProcessDefinition> definitions = repositoryService.createProcessDefinitionQuery().list();
    System.out.println(definitions.size());

The above code runs successfully but the output is always 0.

I've done some investigations and found that in the ACT_GE_BYTEARRAY table an entry with the corresponding deploymentId exists and the BYTES_ column contains that contents of the definitions file.

I have also found that there is no corresponding entry found in ACT_RE_PROCDEF table.

Is there something messing? from the API and the examples I found it seems that the above code shall suffice, or is there a missing step?

Thanks for your help

like image 579
tariqd Avatar asked Mar 09 '23 21:03

tariqd


1 Answers

It turned out that the issue was related to definitionName (thanks thorben!) as it has to ends on either .bpmn20.xml or .bpmn.

After further testing, the suffix is required for the following definitionName of the code

    deploymentBuilder.addInputStream(definitionName, definitionFileInputStream);

Leaving the following definitionName without the suffix is fine

    repositoryService.createDeployment().name(definitionName);
like image 169
tariqd Avatar answered May 16 '23 06:05

tariqd