Incident Handler

Hello,

We are migrating to Camunda 8 and we would like to add a global incident handler.

Here is what we did in V7 :

@Component
public class CustomIncidentConfiguration extends AbstractProcessEnginePlugin {

    private final TestService testService ;

    public CustomIncidentConfiguration(TestService testService ) {
        this.testService = testService ;
    }

    @Override
    public void preInit(ProcessEngineConfigurationImpl processEngineConfiguration) {
        processEngineConfiguration.setCustomIncidentHandlers(List.of(new TestIncidentHandler(testService )));
    }
}

public class TestIncidentHandler extends DefaultIncidentHandler {

    private final TestService testService ;

    public TestIncidentHandler(TestService testService ) {
        super(Incident.FAILED_JOB_HANDLER_TYPE);
        this.testService = testService ;
    }

    @Override
    public Incident handleIncident(IncidentContext incidentContext, String message) {
        ExecutionEntity execution = Context.getCommandContext().getExecutionManager().findExecutionById(incidentContext.getExecutionId());

      // Business code

        return createIncident(incidentContext, message);
    }

}

What is the equivalent in v8 ?
Thx

Hi @yoann,

there is no incident handler in Camunda Platform 8. But depending on your use case, you could build something similar.

If you use the SaaS offering then you can set up alerts to get notified via Webhook or email. Read more about it here: Manage alerts | Camunda Platform 8

Or, you can query the Operate API for incidents. Operate API (REST) | Camunda Platform 8

If you use a Self-Managed version then you use an exporter to get notified when an incident is created. For example, use the official Elasticsearch exporter, or a community exporter.

There is also a concrete example exporter for incidents. See here: GitHub - jwulf/zeebe-incident-alerter: An exporter to alert on Incident creation via a Web hook

Does this help you?

Best regards,
Philipp

1 Like

Hi Philipp,

Thank you for your answer.
I use a self-managed version, I will have a look at the Zeebe Incident Alerter.