Element Templates not powerful enough for Signal Event with Execution Listener?

Together with my current consulting customer, I tried to come up an element template for the following example:

The Element Template should:

  1. only apply to Throwing Signal Events
  2. add a Signal with the name ‘SubscribeToThisSignalAndDie’ without showing it
  3. add a predefined ExecutionListener without showing it
  4. hide the original Signal and Signal Name properties
  5. add a camunda:property with the name ‘signalName’ and a value defined by the user

Except for number 5, all other requirements seem hard if not impossible to realize with the current mechanism.

Here is the XML that we want to produce:

<bpmn:intermediateThrowEvent id="IntermediateThrowEvent_0f68r99" name="waiting canceled">
  <bpmn:extensionElements>
    <camunda:executionListener class="com.camunda.bpm.demo.signal_event_interrupts_parallel_branch.SendSignalToParallelBranchExecutionLister" event="start" />
    <camunda:properties>
      <camunda:property name="signalName" value="waitingCanceled" />
    </camunda:properties>
  </bpmn:extensionElements>
  <bpmn:incoming>SequenceFlow_0dlumc1</bpmn:incoming>
  <bpmn:outgoing>SequenceFlow_1c84drg</bpmn:outgoing>
  <bpmn:signalEventDefinition signalRef="Signal_12lmyze" />
</bpmn:intermediateThrowEvent>

<bpmn:signal id="Signal_12lmyze" name="SubscribeToThisSignalAndDie" />

And here is how we imagined the JSON:

[
  {
    "name": "Signal to Parallel Branch within same Process Instance",
    "id": "com.camunda.example.SignalToParallelBranch",
    "appliesTo": [
      "bpmn:intermediateThrowEvent[bpmn:signalEventDefinition]", // we tried to write it in XPath notation
      "bpmn:endEvent[?(@.bpmn:signalEventDefinition)]" // or how about JSONPath
    ],
    "properties": [
      {
        "type": "Hidden",
        "binding": {
          "type": "bpmn:signal",
          "name": "SubscribeToThisSignalAndDie"
        }
      },
      {
        "type": "Hidden",
        "value": "com.camunda.bpm.demo.signal_event_interrupts_parallel_branch.SendSignalToParallelBranchExecutionLister",
        "binding": {
          "type": "camunda:executionListener",
          "event": "start",
          "isClass": true
        }
      },
      {
        "label": "Signal Name",
        "type": "String",
        "binding": {
          "type": "camunda:property",
          "name": "signalName"
        },
        "constraints": {
          "notEmpty": true
        }
      }
    ],
    "entriesVisible": {
      "_all": true,
      "signal": false, // how does one find these ids? 
      "signal-element-name": false // not even looking in the code seems to help: https://github.com/bpmn-io/bpmn-js-properties-panel/blob/5a03df94f59cc8642bd2af404382b4e8115df968/lib/provider/bpmn/parts/implementation/SignalEventDefinition.js
    }
  }
]

Could you please give us some feedback, if something like this is possible today or in future.

1 Like

Hi @falko.menge!

Element templates on typed events are not possible right now. It could be a valuable addition in the future though. I added the issue camunda/camunda-modeler#343 for that. Defining event listeners is currently not possible, too.

It would be interesting to get your feedback on twp things:

  • If you had the choice, should the template apply to a specific typed event only? Or should applying it change the un-typed event to the given typed event? I.e. apply to all blank intermediate events and transform these automatically to Signal Throw Events with custom fields.

  • Should templates be able to map to event definition properties as well as event properties?

Element templates should aplly to typed events because many people interpret them as separate elements and they have completely different properties.

A template should have access to both the event and it's event definition.

Sorry, for mixing up so many issues in one topic, but what do you think about the hidden fields?

Already supported via property.hidden=true. Your suggestion type: "Hidden" looks better to me though.

My current consulting customer also needs Element Templates for Signal Events, i.e. they want to provide a list of known Signal names.