Bug with SignalStart and SignalBoundary events when using signal expression?

Hi,

I face an issue with SignalStart and SignalBoundary events: their signal name (provided as a signal expression) is empty in the event subscription.

As an example to demonstrate the issue, I provide the most simple process: a SignalStart event with a signal expression, linked to a EndEvent (see underneath)

When I deploy, this, the Subscription Event Name is empty, hence the start upon signal is not working:

Additional info:

  • When using a signal reference instead of a signal expression everything works fine
  • Suprisingly, an IntermediateSignalCatchingEvent works just fine with both
  • I see, however, exactly the same problem with a SignalBoundaryEvent

I’m using Flowable Design and Flowable Control, but this shouldn’t matter as this is just core engine functionality.

The process to demonstrate the issue:

<?xml version="1.0" encoding="UTF-8"?>

This is the process:

```xml
<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:flowable="http://flowable.org/bpmn" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:omgdi="http://www.omg.org/spec/DD/20100524/DI" xmlns:design="http://flowable.org/design" typeLanguage="http://www.w3.org/2001/XMLSchema" expressionLanguage="http://www.w3.org/1999/XPath" targetNamespace="http://flowable.org/test" design:palette="flowable-process-palette">
  <process id="simpleSignalStart" name="simple-signal-start" isExecutable="true" flowable:candidateStarterGroups="flowableUser">
    <extensionElements>
      <design:stencilid><![CDATA[BPMNDiagram]]></design:stencilid>
      <design:language><![CDATA[English]]></design:language>
      <design:creationdate><![CDATA[2020-05-31T10:03:17.416Z]]></design:creationdate>
      <design:modificationdate><![CDATA[2020-05-31T10:03:46.989Z]]></design:modificationdate>
    </extensionElements>
    <startEvent id="startSignalEvent1" isInterrupting="true">
      <extensionElements>
        <design:stencilid><![CDATA[StartSignalEvent]]></design:stencilid>
      </extensionElements>
      <signalEventDefinition flowable:signalExpression="signal.test.start"></signalEventDefinition>
    </startEvent>
    <endEvent id="endNoneEvent1">
      <extensionElements>
        <design:stencilid><![CDATA[EndNoneEvent]]></design:stencilid>
      </extensionElements>
    </endEvent>
    <sequenceFlow id="sequenceFlow1" sourceRef="startSignalEvent1" targetRef="endNoneEvent1">
      <extensionElements>
        <design:stencilid><![CDATA[SequenceFlow]]></design:stencilid>
      </extensionElements>
    </sequenceFlow>
  </process>
  <bpmndi:BPMNDiagram id="BPMNDiagram_simpleSignalStart">
    <bpmndi:BPMNPlane bpmnElement="simpleSignalStart" id="BPMNPlane_simpleSignalStart">
      <bpmndi:BPMNShape bpmnElement="startSignalEvent1" id="BPMNShape_startSignalEvent1">
        <omgdc:Bounds height="30.0" width="30.0" x="117.0" y="261.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNShape bpmnElement="endNoneEvent1" id="BPMNShape_endNoneEvent1">
        <omgdc:Bounds height="28.0" width="28.0" x="225.0" y="262.0"></omgdc:Bounds>
      </bpmndi:BPMNShape>
      <bpmndi:BPMNEdge bpmnElement="sequenceFlow1" id="BPMNEdge_sequenceFlow1">
        <omgdi:waypoint x="146.94999840413675" y="276.0"></omgdi:waypoint>
        <omgdi:waypoint x="225.0" y="276.0"></omgdi:waypoint>
      </bpmndi:BPMNEdge>
    </bpmndi:BPMNPlane>
  </bpmndi:BPMNDiagram>
</definitions>

Hi,

I think I tracked down the bug!

In BoundarySignalEventActivityBehavior, only the SignalRef is considered:

    EventSubscriptionEntity eventSubscription = (EventSubscriptionEntity) CommandContextUtil.getEventSubscriptionService(commandContext).createEventSubscriptionBuilder()
                    .eventType(SignalEventSubscriptionEntity.EVENT_TYPE)
                    .eventName(signalEventDefinition.getSignalRef())
                    .signal(signal)
                    .executionId(executionEntity.getId())
                    .processInstanceId(executionEntity.getProcessInstanceId())
                    .activityId(executionEntity.getCurrentActivityId())
                    .processDefinitionId(executionEntity.getProcessDefinitionId())
                    .tenantId(executionEntity.getTenantId())
                    .create();

while in IntermediateCatchSignalEventActivityBehavior, the expression is used if filled in:

    String signalName = null;
    if (StringUtils.isNotEmpty(signalEventDefinition.getSignalRef())) {
        signalName = signalEventDefinition.getSignalRef();
    } else {
        Expression signalExpression = CommandContextUtil.getProcessEngineConfiguration(commandContext).getExpressionManager()
                .createExpression(signalEventDefinition.getSignalExpression());
        signalName = signalExpression.getValue(execution).toString();
    }

    EventSubscriptionEntity eventSubscription = (EventSubscriptionEntity) CommandContextUtil.getEventSubscriptionService(commandContext).createEventSubscriptionBuilder()
                    .eventType(SignalEventSubscriptionEntity.EVENT_TYPE)
                    .eventName(signalName)
                    .signal(signal)
                    .executionId(executionEntity.getId())
                    .processInstanceId(executionEntity.getProcessInstanceId())
                    .activityId(executionEntity.getCurrentActivityId())
                    .processDefinitionId(executionEntity.getProcessDefinitionId())
                    .tenantId(executionEntity.getTenantId())
                    .create();

Not sure where to look for the StartEvent, but probably same construction as with the BoundarySignalEvent!