Reputation: 135
ENV: camunda 7.4, BPMN 2.0
Given a process, which can be started by multiple start message events.
Some APIs like IncidentMessages?
Upvotes: 0
Views: 507
Reputation: 1587
That is no out-of-the-box feature but should be easy to build by using process variables.
The basic steps are:
public class MessageStartEventListener implements ExecutionListener {
public void notify(DelegateExecution execution) throws Exception {
execution.setVariable("startMessage", "MessageName");
}
}
Note that via DelegateExecution#getBpmnModelElementInstance
you can access the BPMN element that the listener is attached to, so you could determine the message name dynamically.
<process id="executionListenersProcess">
<startEvent id="theStart">
<extensionElements>
<camunda:executionListener
event="start" class="org.camunda.bpm.examples.bpmn.executionlistener.MessageStartEventListener" />
</extensionElements>
<messageEventDefinition ... />
</startEvent>
...
</process>
Note that with a BPMN parse listener, you can add such a listener programmatically to every message start event in every process definition. See this example.
RuntimeService runtimeService = processEngine.getRuntimeService();
List<ProcessInstance> matchingInstances = runtimeService
.createProcessInstanceQuery()
.variableValueEquals("startMessage", "MessageName")
.list();
Upvotes: 1