1. Message start event
describe
A message start event can be used to start a process instance using named information. This effectively allows us to use the message name to select the correct start event from a set of alternative start events.
When deploying a process definition with one or more message initiation events, the following considerations should be considered:
- The name of the message start event must be unique in the given process definition. A process definition cannot have more than one message initiation event with the same name. When deploying a process definition that contains two or more message start events that reference the same message, or if two or more message start events reference a message with the same message name, Flowable throws an exception.
- The name of the message initiation event must be unique among all deployed process definitions. Flowable raises an exception when deploying a process definition that contains one or more message initiation events
Often, the message referenced by this event has the same name as the message initiation event that has been deployed by other process definitions. - Process versioning: when deploying a new version of a process definition, the start message subscription of the previous version will be deleted.
When a process instance is started, the following method can be used to trigger the message start event RuntimeService:
ProcessInstance startProcessInstanceByMessage(String messageName); ProcessInstance startProcessInstanceByMessage(String messageName, Map<String, Object> processVariables); ProcessInstance startProcessInstanceByMessage(String messageName, String businessKey, Map<String, Object< processVariables);
This is the name messageEventDefinition given in the messageRef attribute referenced by the name attribute message. The following considerations apply when starting a process instance.
- Message initiation events are only supported on top-level processes. Embedded subprocesses do not support message start events.
- If a process definition has multiple message start events, runtimeService.startProcessInstanceByMessage(...) allows you to select the appropriate start event.
- If a process definition has multiple message start events and a single no start event, runtimeService.startProcessInstanceByKey(...) and
runtimeService.startProcessInstanceById(...) starts a process instance with no start event. - If a process definition has multiple message start events and there is no start event, runtimeService.startProcessInstanceByKey(...) and
runtimeService.startProcessInstanceById(...) threw an exception. - If the process definition has a single message start event, runtimeService.startProcessInstanceByKey(...) and
runtimeService.startProcessInstanceById(...) starts a new process instance using a message start event. - If a process starts with an invocation activity, the message start event is supported only when supported
- In addition to the message start event, the process has a no start event
- The procedure has a single message start event and no other start events.
Graphical representation
The message start event is treated as a circle with the message event symbol. The symbol is empty and represents the behavior of capturing (receiving).
XML representation
The XML representation of a message start event is a normal start event declaration with a messageEventDefinition child element:
<definitions id="definitions" xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:flowable="http://flowable.org/bpmn" targetNamespace="Examples" xmlns:tns="Examples"> <message id="newInvoice" name="newInvoiceMessage" /> <process id="invoiceProcess"> <startEvent id="messageStart" > <messageEventDefinition messageRef="tns:newInvoice" /> </startEvent> ... </process> </definitions>
2. Signal start event
describe
A signal start event can be used to start a process instance using a named signal. Signals can use intermediate signals to throw events or through
The API (runtimeService.signalEventReceivedXXX method) is triggered from the process instance. In both cases, all process definitions of signal start events with the same name are started.
Note that in both cases, you can also choose between synchronous and asynchronous startup of process instances.
In signalName, the attribute signalEventDefinition of the element signalRef referenced in the attribute signal of the given name name must be passed in the API.
Graphical representation
The signal start event is visualized as a circle with signal event symbols. The symbol is empty and represents the behavior of capturing (receiving).
XML representation
The XML representation of the signal start event is a normal start event declaration with a child element of signalEventDefinition:
<signal id="theSignal" name="The Signal" /> <process id="processWithSignalStart1"> <startEvent id="theStart"> <signalEventDefinition id="theSignalEventDefinition" signalRef="theSignal" /> </startEvent> <sequenceFlow id="flow1" sourceRef="theStart" targetRef="theTask" /> <userTask id="theTask" name="Task in process A" /> <sequenceFlow id="flow2" sourceRef="theTask" targetRef="theEnd" /> <endEvent id="theEnd" /> </process>
The above article is from Pangu BPM Research Institute: http://vue.pangubpm.com/
Article translation submission: https://github.com/qiudaoke/flowable-userguide
For more articles, you can focus on WeChat official account: