BPMN files in Process application war file

Hi There,
i have just quick question: If I have own process application (shared process engine) with processes.xml and applicationContext.xml, should I have BPM files included in this war file? If the bpmn file has been saved into deployment table, means, that resource name XXX.bpm and source = process application, says where the bpmn file is located on local drive? Other words, bpmn file, which is deployed into DB , is not saved as blob, just reference on this file is saved, right?

When i have this assembly in my war:

Processes.xml
XXX.bpm
applicationContext.xml (java delegate beans)

Then resolver is called and class loader is called too and my beans are loaded. If XXX.bpm file is not part of the war file, then no beans are loaded and error is shown like “Not property found: testService” ,for example.

I debugged source code i see how it works, but my boss still cannot understand, why bpmn file should be in war file, why is not loaded from DB.

Thanks for help.

BR

Lukas P.

Hi Lukas,

I hope I can clarify some things.

  1. Process models are indeed persisted as BLOBs in the database (check the table ACT_GE_BYTEARRAY). Once deployed, the process engine only loads the BPMN files from there.
  2. Why is the process engine not able to resolve beans, etc. when executing a process? The process engine maintains a registry mapping deployments to process applications. If the registry does not contain an entry for a certain deployment, then the process engine is not be able to resolve resources from a process application for it. APIs related to that are ManagementService#registerProcessApplication and ManagementService#unregisterProcessApplication.
  3. Now, why does your process application need to contain the BPMN files in order for bean resolution to work, when you have already deployed them before? In general, it does not have to. However, then the process engine cannot automatically maintain the registry of which deployment is complemented by which process application. If the models are included in the process application, then the process engine determines during application deployment that there is already an existing process deployment for these models and registers the process application automatically.

In essence, if you want your process application to be registered for existing deployments, either include those BPMN resources in the application to trigger automatic registration or register the process application manually by using ManagementService#registerProcessApplication.

Cheers,
Thorben

1 Like

Hi Thorben,
i see, thanks for clarifying, but just additional question, what does it mean, to run manually ManagementService#unregisterProcessApplication. How can i do this and where? It needs deploymentID:

  public void unregisterProcessApplication(String deploymentId, boolean removeProcessesFromCache) {
    commandExecutor.execute(new UnregisterProcessApplicationCmd(deploymentId, removeProcessesFromCache));
  }

Thanks for help.

BR

Lukas P.

Hi Lukas,

You can obtain a deployment IDs by making a deployment query (RepositoryService#createDeploymentQuery). You have to provide the logic to decide which is the correct deployment yourself.

Cheers,
Thorben

Hi Thorben,
i did this:

final Deployment deployment = repositoryService.createDeploymentQuery().list().get(0);
        managementService.unregisterProcessApplication(deployment.getId(), true);
        
        runtimeService.startProcessInstanceByKey("request123");

And BPMN file is not part of war file and i have got this error message:

org.camunda.bpm.engine.impl.javax.el.PropertyNotFoundException: Cannot resolve identifier 'requestDelegate'

So what’s wrong on my side?

Thanks

Lukas

You must use ManagementService#registerProcessApplication to register a process application manually with a shared process engine.

1 Like

Hi,
i thought so, and ProcessApplicationReference i can get like this?

Context.getCurrentProcessApplication()

Thanks for help

Hi All,
i have solved it, thanks for your help :slight_smile:

BR

Lukas P.

How do you finally solve this ?
I’m in a similar issue.

Context.getCurrentProcessApplication() is null, I understood it should be in a CommandExecutor ??

You can obtain an instance of ProcessApplicationReference via ProcessApplicationInterface#getReference. ProcessApplicationInterface is implemented by all process application classes. E.g. you can obtain the reference in an @PostDeploy method of your process application.

Cheers,
Thorben