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

DelegateExecutionContext.getCurrentDelegationExecution() does not provide current execution when used in signal expression

XMLWordPrintable

    • Icon: Bug Report Bug Report
    • Resolution: Fixed
    • Icon: L3 - Default L3 - Default
    • 7.18.0, 7.17.2, 7.16.9, 7.18.0-alpha2
    • None
    • None
    • None

      Environment (Required on creation):

      • Any Camunda engine version
      • BPMN process with an intermediate signal event using an expression to call DelegateExecutionContext.getCurrentDelegationExecution()

      Description (Required on creation; please attach any relevant screenshots, stacktraces, log files, etc. to the ticket):

      When an intermediate signal event uses an expression like ${Somebean.getSignalName()} to call DelegateExecutionContext.getCurrentDelegationExecution(), the call returns null.

      Steps to reproduce (Required on creation):

      • Create a BPMN process including an intermediate signal event
      • The signal event calls some delegation class via expression (e.g., ${Somebean.getSignalName()})
      • The delegation code executes and returns the result of the following call: DelegateExecutionContext.getCurrentDelegationExecution()
      • The result is null

      To reproduce the issue, you can simply run the spring boot application: https://github.com/rtkohl/signal-name-test

      Observed Behavior (Required on creation):

      When running the example project mentioned above, first a service task calls the problematic code. This works fine. The current execution is returned.
      The delegate for the signal activity returns null for the following call:

      String activityId = DelegateExecutionContext.getCurrentDelegationExecution().getCurrentActivityId();
      

      Expected behavior (Required on creation):

      The activity id of the signal event is returned.

      Root Cause (Required on prioritization):

      The intermediate signal activity is a scope. This means that a new execution is created for it.

      This is done here: https://github.com/camunda/camunda-bpm-platform/blob/cab8852cda1822b7d4551122b70bc56fa7f2f2b8/engine/src/main/java/org/camunda/bpm/engine/impl/pvm/runtime/operation/PvmAtomicOperationCreateScope.java#L40
      The new execution is never set for the DelegateExecutionContext. The call still returns the process instance execution.

      Solution Ideas (Optional):

      Set the newly created execution as context execution on the delegate invocation. Then the context is updated in the DefaultDelegateInterceptor: https://github.com/camunda/camunda-bpm-platform/blob/cab8852cda1822b7d4551122b70bc56fa7f2f2b8/engine/src/main/java/org/camunda/bpm/engine/impl/delegate/DefaultDelegateInterceptor.java#L89

      Hints (optional):

        This is the controller panel for Smart Panels app

              miklas.boskamp Miklas Boskamp
              miklas.boskamp Miklas Boskamp
              Miklas Boskamp Miklas Boskamp
              Thorben Lindhauer Thorben Lindhauer
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: