camunda-community-hub / camunda-platform-7-reactor

Event Driven process applications
https://camunda.github.io/camunda-bpm-reactor/
Apache License 2.0
80 stars 34 forks source link

Duplicate events fired when an error boundary is attached #117

Open juja0 opened 3 years ago

juja0 commented 3 years ago

Reactor listeners seem to be called twice when error boundaries are attached (on a service task for example).

This seems to be because the class RegisterAllBpmnParseListener adds execution listeners on both 'parseBoundaryErrorEventDefinition' and 'parseServiceTask' but since both parse* methods will be called on the same activity, the same listener instance is attached twice.

There could be other scenarios where duplicates can be attached since there are other parseBoundary* methods on the listener so I think it's reasonable to perform a check to see if reactor listener is already registered before registering. Right now, we just add the listener without any checks by calling activity.addListener. I would be happy to submit a PR but wanted to discuss and agree on an approach before doing so.

007souvikdas commented 3 years ago

happening for message event as well, its "start" and "end" gets triggered twice