Global listeners for processes

Hi,

We have a requirement to do some alerting at the process definition/task level. An example would be - a user would like to receive some notification if the process/task failed or if it took longer to complete. I am looking for a global listener that can help with this. I should be able to write custom code to see what should be the alert I should be sending.

Is there any option for this?

Thanks,
Deepika

@deepu.v87 Yes it’s possible. You can write global listener and register it with process engine like the below example.

https://github.com/Camunda-ChrisAllen/camunda-sb-executionlistener-example

Thanks a ton @aravindhrs . That helped.

Is there anything that would help me capture the incidents/task failures with the help of listeners?

Also looking for listeners that would help with timer start events. If I schedule a process definition to start at 12 noon everyday, I should be able to know if it triggered at 12 noon.

Is there any listeners I can make use of to see long running tasks/processes?

To get the incident for processInstance:

Incident incident = delegateTask.getProcessEngineServices().getRuntimeService()
  .createIncidentQuery().processInstanceId("processInstanceId").singleResult();

String incidentMessage = incident.getIncidentMessage();

To create a incident for any task:

delegateTask.getProcessEngineServices().getRuntimeService()
 .createIncident("incidentType", "executionId", "configuration");

From ExecutionListener, you can write like this:

execution.createIncident("incidentType", "executionId", "configuration");

You can model your bpmn similar like below. In Send Task activity you can configure delegate to trigger a email. Note that it will trigger an email for every process instance.

image

Or try like this:

notifier.bpmn (5.2 KB)