Hi!
How Can I subscribe on a running process? I would like to log or check If the process status has been changed.
After this: Long instanceId = zeebe.newCreateInstanceCommand()
.bpmnProcessId(processId)
.latestVersion()
.variables(processVariableMap)
.send()
.join()
.getProcessInstanceKey();
I tried @JobWorker with a handler method but an event received only ACTIVED status. I need COMPLETED status too if the process ran or not. how can I do this? Thank you!
zeebe.newWorker()
.jobType(“io.camunda:http-json:1”)
.handler((jobClient, job) → {
// Handle the process instance event
long processInstanceKey = job.getProcessInstanceKey();
ProcessInstance processInstance = camundaService.getProcessInstance(processInstanceKey);
switch(processInstance.getState()) {
case COMPLETED:
log.info("Process completed with key: {}", processInstanceKey);
break;
case ACTIVE:
log.info("Process failed with key: {}", processInstanceKey);
break;
case CANCELED:
log.info("Process canceled with key: {}", processInstanceKey);
break;
}
// Complete the job
jobClient.newCompleteCommand(job.getKey()).send().join();
})
.open();
bpmn:extensionElements
<zeebe:taskDefinition type=“io.camunda:http-json:1” />
zeebe:ioMapping