Hi everyone,
I am using camunda at the time of tomcat server startup by using JNDI binding. We are binding the name/type/auth/factory of process engine and application to ContextResource. I want to use the global listeners i. getTaskListener and the getExecutionListerner but I am unsure how to register them given I am using these JNDI bindings.
Looks something like:
For ProcessApplication:
org.apache.tomcat.util.descriptor.web.ContextResource resource = new ContextResource();
resource.setName(“global/camunda-bpm-platform/process-engine/ProcessApplicationService!org.camunda.bpm.ProcessApplicationService”)
resource.setAuth(“Container”);
resource.setType(“org.camunda.bpm.ProcessApplicationService”);
resource.setProperty(“factory”, “com.amazon.swayamcamunda.automation.CustomProcessApplicationService”);
getServer().getGlobalNamingResources().addResource(resource);
For ProcessEngine:
org.apache.tomcat.util.descriptor.web.ContextResource resource = new ContextResource();
resource.setName(“global/camunda-bpm-platform/process-engine/ProcessEngineService!org.camunda.bpm.ProcessEngineService”)
resource.setAuth(“Container”);
resource.setType(“org.camunda.bpm.ProcessEngineService”);
resource.setProperty(“factory”, “org.camunda.bpm.container.impl.jndi.ProcessEngineServiceObjectFactory”);
getServer().getGlobalNamingResources().addResource(resource);
bpm-platform.xml:
<?xml version="1.0" encoding="UTF-8"?><bpm-platform xmlns="http://www.camunda.org/schema/1.0/BpmPlatform" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.camunda.org/schema/1.0/BpmPlatform http://www.camunda.org/schema/1.0/BpmPlatform "> <process-engine name="default"> .... <plugins> <!-- plugin enabling Process Application event listener support --> <plugin> <class>com.amazon.swayamcamunda.automation.CustomProcessApplicationEventListenerPlugin</class> </plugin> </plugins> </process-engine>
Deploying the bpmn files:
ProcessEngine processEngine = ProcessEngines.getDefaultProcessEngine();
RepositoryService repoService = processEngine.getRepositoryService();File file = new File(bpmnFile); BpmnModelInstance modelInstance = Bpmn.readModelFromFile(file); repoService.createDeployment() .name(processApplicationName) .addModelInstance(file.getName(), modelInstance) .enableDuplicateFiltering(true) .deploy();