Uploaded image for project: 'camunda BPM'
  1. camunda BPM
  2. CAM-7434

@StartActivity CDI listener is invoked twice via CDI event bridge for BPMN start events

    Details

    • Type: Bug Report
    • Status: Open
    • Priority: L3 - Default
    • Resolution: Unresolved
    • Affects Version/s: 7.5.0, 7.6.0, 7.4.8, 7.7.0
    • Fix Version/s: 7.4.x, 7.5.x, 7.6.x, 7.7.x
    • Component/s: engine
    • Labels:

      Description

      Scenario: Shared Engine, any application server, process application using the CDI event bridge (https://docs.camunda.org/manual/7.6/user-guide/cdi-java-ee-integration/the-cdi-event-bridge/)

      Process application has a CDI bean that listens for the start execution event of the BPMN start event, e.g.:

      @Named
      @Singleton
      public class ListenerBean {
      
        public void logStart(@Observes @StartActivity("StartEvent_1") BusinessProcessEvent aBusinessProcessEvent) {
          // do something useful
        }
      }
      

      StartEvent_1 is the start event of the process.

      Observed behavior: Whenever a process instance is started, the listener is invoked twice.

      Expected behavior: Listener is invoked once

      Reason for observed behavior: The CdiEventListener that is provided by the process application is invoked once for process start and once for activity start. This is good. However, both invocations produce the same CDI event, because the context execution has already activity id = <start event id> when the process start listener is invoked. That means, the core problem is in org.camunda.bpm.engine.cdi.impl.event.CdiEventListener.createEvent(DelegateExecution) that should create distinguishable events for the two invocations.

      Side note: This cannot be reproduced with a unit test that uses CdiEventSupportBpmnParseListener to register the CdiEventListener, because the former does not register the listener for process start.

      Similar issues might exist with end events.

        Activity

        There are no comments yet on this issue.

          People

          • Assignee:
            Unassigned
            Reporter:
            thorben.lindhauer Thorben Lindhauer
          • Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated: