Process Definition as "Database Deployment" without .bpmn file

We have built an Embedded Process Engine WAR deployment without Spring including the REST interface to deploy to WildFly with Camunda 7.4.0. It works fine.

Our goal is to distribute that WAR file without any .bpmn deployments inside and “upload” workflows created with the Modeler via the REST interface. Also that seems to work fine, but we have noticed that i.e. CDI is not working for such “database only” deployments with no .bpmn file. The reason for this obviously is, that these “database only” deployments are not registered (via ProcessApplicationManager.registerProcessApplicationForDeployments()) and thus no CdiResolver is available for that process.

A workaround seems to be to register the “database only” deployments manually in the ServletProcessApplication using the deploymentId:

@PostDeploy
public void onDeploymentFinished(final ProcessEngine processEngine) {
    final List<ProcessDefinition> processDefinitions = processEngine
            .getRepositoryService().createProcessDefinitionQuery().list();
    processDefinitions.forEach(p -> {
        processEngine.getManagementService()
        .registerProcessApplication(p.getDeploymentId(), this.reference);
    });
}

Like that, CDI works.

While we think this is a decent solution, we want to make sure we are not misusing the system? Are there other ways to provide an empty deployment with no predefined workflows and add workflows at runtime?

Hi Torsten,

Your solution is a valid approach to solve the problem of having an empty process engine and dynamically adding workflows.
What you could do a step further is to extend the Camunda Rest API and expose the registerProcessApplication method as an operation.
You then can call it after you deployed the workflow with the resulting deployment id of the create deployment operation.
Regarding the deployment of the WAR, I suppose only a single deployment of the WAR on each server is done? Is it supposed to work in a cluster with a shared database?

Cheers,
Christian

1 Like

Hi Christian,

Thanks for the quick reply and the suggestion to expose registerProcessApplication via the REST API. It’s great because that solves our remaining question: how to register a workflow immediately after deploying it.

Yes, we’ll only deploy just one of that WAR on each server and we don’t do clustering for now, but it might become relevant in the future.

Cheers,
Torsten

I have a question about this - if there are multiple nodes in a cluster, will using the REST API on one node to register a deployment with an application cause all of the engines on the other nodes to recognize that registration?