Custom Incident Handler

693 views
Skip to first unread message

Markus Hens

unread,
Mar 4, 2016, 5:20:48 AM3/4/16
to camunda BPM users
Hi guys,

I implemented a custom incident handler which sends an email if an incident occures means if handleIncident() is called.

I registered that incidentHandler like shown below:

{code}

<property name="customIncidentHandlers"><!-- Custom incident handler which sends emails-->

        <list>

            <ref bean="emailNotificationIncidentHandler"/> 

            </list>

        </property>

{code}

This works fine unfortunately the org.camunda.bpm.engine.impl.incident.DefaultIncidentHandler is no longer called so no incident is created in database. Even if I configure it as bean and add it to list of customIncidentHandlers it does not work. 

So my questions are:

1. Is it not possible to configure more then one customIncidentHandler? 
2.How do I have to configure the org.camunda.bpm.engine.impl.incident.DefaultIncidentHandler when I also want to use one customIncidentHandler? I would like to achieve that both incident handlers are called.

Best regards,

Markus

thorben....@camunda.com

unread,
Mar 4, 2016, 5:35:32 AM3/4/16
to camunda BPM users
Hi Markus,

You can have one incident handler per incident handler type. If you want to handlers for a type, you could implement a composite handler that delegates the event to a set of handlers. That set could include the default handler and your custom handler.

Cheers,
Thorben

Markus Hens

unread,
Mar 4, 2016, 5:43:01 AM3/4/16
to camunda BPM users
Hi Thorben,

thanks for the quick reply. No I understand how it works.

Maybe you can add some documentation which clarifies this. In my opinion the actual documentation is misleading at his point see following quote from the documentation

" If you want to provide a custom incident handler implementation you can replace one or multiple incident handlers using the following method: org.camunda.bpm.engine.impl.cfg.ProcessEngineConfigurationImpl.setCustomIncidentHandlers(List<IncidentHandler>)" 

Best regards,

Markus

thorben....@camunda.com

unread,
Mar 4, 2016, 5:52:05 AM3/4/16
to camunda BPM users
Hi Markus,

Good to read that you were able to resolve that.

Can you please provide a link to the docs section you took the quote from? What exactly do you find misleading about it? The sentence explicitly says that the method is about replacing handlers, not adding additional handlers for the same type. I could imagine that we extend the docs and outline the idea of a composite handler, or provide an example.

Cheers,
Thorben

Markus Hens

unread,
Mar 4, 2016, 5:59:17 AM3/4/16
to camunda BPM users
Hi Thorbe,

I took it from https://docs.camunda.org/manual/7.4/user-guide/process-engine/incidents/ "Implement Custom Incident Handlers" section.

I think its misleading that you set a list of incident handlers but it is not documented that you can only have one per type. When reading it and looking at the API  I thought I could add a list of incident handlers and all of them are called when the incident occured. Maybe it  can be added to documentation that only one per type can be registered. But this is only a proposal :) .

Best regards, 

Markus

thorben....@camunda.com

unread,
Mar 4, 2016, 7:23:35 AM3/4/16
to camunda BPM users
Hi Markus,

Feel free to extend that section and make a pull request against the docs repository [1]. Editing markdown files and creating a pull request can be done in the github UI, so you don't have to clone the repository or build the docs yourself.

Cheers,
Thorben

[1] https://github.com/camunda/camunda-docs-manual/blob/master/content/user-guide/process-engine/incidents.md
Reply all
Reply to author
Forward
0 new messages