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

XMLWordPrintable

    • Icon: Bug Report Bug Report
    • Resolution: Unresolved
    • Icon: L3 - Default L3 - Default
    • None
    • 7.5.0, 7.6.0, 7.4.8, 7.7.0
    • engine

      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.

        This is the controller panel for Smart Panels app

              Unassigned Unassigned
              thorben.lindhauer Thorben Lindhauer
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated: