Both sides previous revision Previous revision Next revision | Previous revision |
en:rule:control_branch [2024-01-08 19:36] – [✘ How NOT to] Anatoly Belaychuk | en:rule:control_branch [2024-11-02 13:36] (current) – [Edit diagram] Anatoly Belaychuk |
---|
====== Use a subprocess and a control branch as an alternative to the attached event ====== | ====== A subprocess and a control branch may be used as an alternative to the attached event ====== |
| |
{{tag>subprocess gateway event "attached event"}} | {{tag>subprocess event attached_event terminate_event}} |
| |
Use a subprocess containing the control branch to implement versatile event processing logic. | Use a subprocess containing the control branch to implement versatile event processing logic. |
| |
===== ✔ How to ===== | ===== ✔ How to ===== |
| |
- Start the subprocess with the parallel gateway followed by two branches, "working" and "control". | - Start the subprocess with the parallel gateway followed by two branches, "working" and "control". |
- Put the "Obtain payment" at the working branch. | - Put the "Obtain payment" at the working branch. |
- Put the timer to the control branch. | - Put the timer at the control branch. |
- End both the working and control branch with terminate events. | - End both the working and control branch with the terminate event. |
| |
<bpmnio type="bpmn"> | <bpmnio type="bpmn"> |
===== ✘ How NOT to ===== | ===== ✘ How NOT to ===== |
| |
Attached timer, while a better alternative in simple scenarios, won't do the job if need to discuss the issue with client while still trying to obtain the payment: | Interrupting attached timer won't let discussing the issue with client while still trying to obtain the payment: |
| |
<bpmnio type="bpmn"> | <bpmnio type="bpmn"> |
</startEvent> | </startEvent> |
<sequenceFlow id="Flow_1mqvexf" sourceRef="Event_0jid81n" targetRef="Activity_1mnvjuz" /> | <sequenceFlow id="Flow_1mqvexf" sourceRef="Event_0jid81n" targetRef="Activity_1mnvjuz" /> |
<sequenceFlow id="Flow_1fkn8r9" sourceRef="Event_0r0tew3" targetRef="Activity_1skmlnn" /> | |
<endEvent id="Event_1k1tn88" name="Paid"> | <endEvent id="Event_1k1tn88" name="Paid"> |
<incoming>Flow_0b5yo8b</incoming> | <incoming>Flow_0b5yo8b</incoming> |
</endEvent> | </endEvent> |
<sequenceFlow id="Flow_0b5yo8b" sourceRef="Activity_1mnvjuz" targetRef="Event_1k1tn88" /> | <sequenceFlow id="Flow_0b5yo8b" sourceRef="Activity_1mnvjuz" targetRef="Event_1k1tn88" /> |
<boundaryEvent id="Event_0r0tew3" name="Payment due date" cancelActivity="false" attachedToRef="Activity_1mnvjuz"> | <boundaryEvent id="Event_0r0tew3" name="Payment due date" attachedToRef="Activity_1mnvjuz"> |
<outgoing>Flow_1fkn8r9</outgoing> | <outgoing>Flow_0xmx632</outgoing> |
<timerEventDefinition id="TimerEventDefinition_1u44tv6" /> | <timerEventDefinition id="TimerEventDefinition_0f85qyr" /> |
</boundaryEvent> | </boundaryEvent> |
<task id="Activity_1skmlnn" name="Clarify delay with the client"> | <sequenceFlow id="Flow_0xmx632" sourceRef="Event_0r0tew3" targetRef="Event_04k06ga" /> |
<incoming>Flow_1fkn8r9</incoming> | |
<outgoing>Flow_0gsynar</outgoing> | |
</task> | |
<sequenceFlow id="Flow_0gsynar" sourceRef="Activity_1skmlnn" targetRef="Gateway_1sygjo0" /> | |
<exclusiveGateway id="Gateway_1sygjo0" name="Wait more?"> | |
<incoming>Flow_0gsynar</incoming> | |
<outgoing>Flow_0jzxjdu</outgoing> | |
<outgoing>Flow_16a0qq5</outgoing> | |
</exclusiveGateway> | |
<sequenceFlow id="Flow_0jzxjdu" name="no" sourceRef="Gateway_1sygjo0" targetRef="Event_04k06ga" /> | |
<endEvent id="Event_04k06ga" name="Not paid"> | <endEvent id="Event_04k06ga" name="Not paid"> |
<incoming>Flow_0jzxjdu</incoming> | <incoming>Flow_0xmx632</incoming> |
<terminateEventDefinition id="TerminateEventDefinition_1uvti5o" /> | |
</endEvent> | </endEvent> |
<endEvent id="Event_1ltc3ao" name="Overdue"> | |
<incoming>Flow_16a0qq5</incoming> | |
</endEvent> | |
<sequenceFlow id="Flow_16a0qq5" name="yes" sourceRef="Gateway_1sygjo0" targetRef="Event_1ltc3ao" /> | |
</process> | </process> |
<bpmndi:BPMNDiagram id="BpmnDiagram_1"> | <bpmndi:BPMNDiagram id="BpmnDiagram_1"> |
</bpmndi:BPMNLabel> | </bpmndi:BPMNLabel> |
</bpmndi:BPMNShape> | </bpmndi:BPMNShape> |
<bpmndi:BPMNShape id="Activity_1skmlnn_di" bpmnElement="Activity_1skmlnn"> | <bpmndi:BPMNShape id="Event_0u9z69r_di" bpmnElement="Event_04k06ga"> |
<omgdc:Bounds x="200" y="-10" width="100" height="80" /> | <omgdc:Bounds x="232" y="-8" width="36" height="36" /> |
<bpmndi:BPMNLabel /> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNShape id="Gateway_1sygjo0_di" bpmnElement="Gateway_1sygjo0" isMarkerVisible="true"> | |
<omgdc:Bounds x="345" y="5" width="50" height="50" /> | |
<bpmndi:BPMNLabel> | <bpmndi:BPMNLabel> |
<omgdc:Bounds x="342" y="-19" width="55" height="14" /> | <omgdc:Bounds x="230" y="35" width="41" height="14" /> |
</bpmndi:BPMNLabel> | </bpmndi:BPMNLabel> |
</bpmndi:BPMNShape> | </bpmndi:BPMNShape> |
<bpmndi:BPMNShape id="Event_08w64xf_di" bpmnElement="Event_04k06ga"> | <bpmndi:BPMNShape id="Event_0sh9f2p_di" bpmnElement="Event_0r0tew3"> |
<omgdc:Bounds x="452" y="12" width="36" height="36" /> | |
<bpmndi:BPMNLabel> | |
<omgdc:Bounds x="450" y="55" width="41" height="14" /> | |
</bpmndi:BPMNLabel> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNShape id="Event_1ltc3ao_di" bpmnElement="Event_1ltc3ao"> | |
<omgdc:Bounds x="352" y="112" width="36" height="36" /> | |
<bpmndi:BPMNLabel> | |
<omgdc:Bounds x="349" y="155" width="43" height="14" /> | |
</bpmndi:BPMNLabel> | |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNShape id="Event_0am8is2_di" bpmnElement="Event_0r0tew3"> | |
<omgdc:Bounds x="232" y="-98" width="36" height="36" /> | <omgdc:Bounds x="232" y="-98" width="36" height="36" /> |
<bpmndi:BPMNLabel> | <bpmndi:BPMNLabel> |
<omgdi:waypoint x="148" y="-120" /> | <omgdi:waypoint x="148" y="-120" /> |
<omgdi:waypoint x="200" y="-120" /> | <omgdi:waypoint x="200" y="-120" /> |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNEdge id="Flow_1fkn8r9_di" bpmnElement="Flow_1fkn8r9"> | |
<omgdi:waypoint x="250" y="-62" /> | |
<omgdi:waypoint x="250" y="-10" /> | |
</bpmndi:BPMNEdge> | </bpmndi:BPMNEdge> |
<bpmndi:BPMNEdge id="Flow_0b5yo8b_di" bpmnElement="Flow_0b5yo8b"> | <bpmndi:BPMNEdge id="Flow_0b5yo8b_di" bpmnElement="Flow_0b5yo8b"> |
<omgdi:waypoint x="352" y="-120" /> | <omgdi:waypoint x="352" y="-120" /> |
</bpmndi:BPMNEdge> | </bpmndi:BPMNEdge> |
<bpmndi:BPMNEdge id="Flow_0gsynar_di" bpmnElement="Flow_0gsynar"> | <bpmndi:BPMNEdge id="Flow_0xmx632_di" bpmnElement="Flow_0xmx632"> |
<omgdi:waypoint x="300" y="30" /> | <omgdi:waypoint x="250" y="-62" /> |
<omgdi:waypoint x="345" y="30" /> | <omgdi:waypoint x="250" y="-8" /> |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNEdge id="Flow_0jzxjdu_di" bpmnElement="Flow_0jzxjdu"> | |
<omgdi:waypoint x="395" y="30" /> | |
<omgdi:waypoint x="452" y="30" /> | |
<bpmndi:BPMNLabel> | |
<omgdc:Bounds x="417" y="12" width="13" height="14" /> | |
</bpmndi:BPMNLabel> | |
</bpmndi:BPMNEdge> | |
<bpmndi:BPMNEdge id="Flow_16a0qq5_di" bpmnElement="Flow_16a0qq5"> | |
<omgdi:waypoint x="370" y="55" /> | |
<omgdi:waypoint x="370" y="112" /> | |
<bpmndi:BPMNLabel> | |
<omgdc:Bounds x="377" y="78" width="17" height="14" /> | |
</bpmndi:BPMNLabel> | |
</bpmndi:BPMNEdge> | </bpmndi:BPMNEdge> |
</bpmndi:BPMNPlane> | </bpmndi:BPMNPlane> |
</definitions> | </definitions> |
</bpmnio> | </bpmnio> |
| |
| Non-interrupting looks better but it won't let resetting the timer to the new due date: |
| |
<bpmnio type="bpmn"> | <bpmnio type="bpmn"> |
<sequenceFlow id="Flow_1mqvexf" sourceRef="Event_0jid81n" targetRef="Activity_1mnvjuz" /> | <sequenceFlow id="Flow_1mqvexf" sourceRef="Event_0jid81n" targetRef="Activity_1mnvjuz" /> |
<sequenceFlow id="Flow_1fkn8r9" sourceRef="Event_0r0tew3" targetRef="Activity_1skmlnn" /> | <sequenceFlow id="Flow_1fkn8r9" sourceRef="Event_0r0tew3" targetRef="Activity_1skmlnn" /> |
<endEvent id="Event_1k1tn88" name="Paid"> | |
<incoming>Flow_0b5yo8b</incoming> | |
</endEvent> | |
<sequenceFlow id="Flow_0b5yo8b" sourceRef="Activity_1mnvjuz" targetRef="Event_1k1tn88" /> | <sequenceFlow id="Flow_0b5yo8b" sourceRef="Activity_1mnvjuz" targetRef="Event_1k1tn88" /> |
<boundaryEvent id="Event_0r0tew3" name="Payment due date" cancelActivity="false" attachedToRef="Activity_1mnvjuz"> | <boundaryEvent id="Event_0r0tew3" name="Payment due date" cancelActivity="false" attachedToRef="Activity_1mnvjuz"> |
</endEvent> | </endEvent> |
<sequenceFlow id="Flow_16a0qq5" name="yes" sourceRef="Gateway_1sygjo0" targetRef="Event_1ltc3ao" /> | <sequenceFlow id="Flow_16a0qq5" name="yes" sourceRef="Gateway_1sygjo0" targetRef="Event_1ltc3ao" /> |
| <endEvent id="Event_1k1tn88" name="Paid"> |
| <incoming>Flow_0b5yo8b</incoming> |
| <terminateEventDefinition id="TerminateEventDefinition_1srmvcb" /> |
| </endEvent> |
</process> | </process> |
<bpmndi:BPMNDiagram id="BpmnDiagram_1"> | <bpmndi:BPMNDiagram id="BpmnDiagram_1"> |
<bpmndi:BPMNShape id="Event_0jid81n_di" bpmnElement="Event_0jid81n"> | <bpmndi:BPMNShape id="Event_0jid81n_di" bpmnElement="Event_0jid81n"> |
<omgdc:Bounds x="112" y="-138" width="36" height="36" /> | <omgdc:Bounds x="112" y="-138" width="36" height="36" /> |
</bpmndi:BPMNShape> | |
<bpmndi:BPMNShape id="Event_0ok4f4i_di" bpmnElement="Event_1k1tn88"> | |
<omgdc:Bounds x="352" y="-138" width="36" height="36" /> | |
<bpmndi:BPMNLabel> | |
<omgdc:Bounds x="359" y="-95" width="23" height="14" /> | |
</bpmndi:BPMNLabel> | |
</bpmndi:BPMNShape> | </bpmndi:BPMNShape> |
<bpmndi:BPMNShape id="Activity_1skmlnn_di" bpmnElement="Activity_1skmlnn"> | <bpmndi:BPMNShape id="Activity_1skmlnn_di" bpmnElement="Activity_1skmlnn"> |
<bpmndi:BPMNLabel> | <bpmndi:BPMNLabel> |
<omgdc:Bounds x="349" y="155" width="43" height="14" /> | <omgdc:Bounds x="349" y="155" width="43" height="14" /> |
| </bpmndi:BPMNLabel> |
| </bpmndi:BPMNShape> |
| <bpmndi:BPMNShape id="Event_05jo8b9_di" bpmnElement="Event_1k1tn88"> |
| <omgdc:Bounds x="352" y="-138" width="36" height="36" /> |
| <bpmndi:BPMNLabel> |
| <omgdc:Bounds x="359" y="-95" width="23" height="14" /> |
</bpmndi:BPMNLabel> | </bpmndi:BPMNLabel> |
</bpmndi:BPMNShape> | </bpmndi:BPMNShape> |
===== Notes ===== | ===== Notes ===== |
| |
- [[en:rule:event_gateway_warning | Exclusive event-based gateway ]] won't do the job. | - Although it's usually better to use [[en:rule:collapsed_subprocess|collapsed representation of a subprocess]] to isolate its internals, it may make sence to depict the subprocess expanded in this technique to make the logic clear. |
- Although it's usually better to use [[en:rule:collapsed_subprocess | collapsed representation of a process ]] to isolate its internals, it may make sence to depict the subprocess expanded in this technique to make the logic clear. | - As an exception to the [[en:rule:explicit_parallel_split|general rule]], one may initiate work and control flows directly from the start event: |
- As an exception to the [[en:rule:one_outgoing_control_flow | general rule ]], one may initiate work and control flows directly from the start event: | |
| |
<bpmnio type="bpmn"> | <bpmnio type="bpmn"> |
</definitions> | </definitions> |
</bpmnio> | </bpmnio> |
===== Exceptions ===== | ===== See also ===== |
| |
Attached events are simpler and hence should be preferred in more straightforward scenarios. | * [[en:rule:event_gateway_warning]] |
| |
===== Autor(s) ===== | ===== Autor(s) ===== |
| |
--- //[[user:bell|Anatoly Belaychuk]] 2023-09-10 11:21// | --- //[[user:bell|Anatoly Belaychuk]] 2023-09-10 11:21// |
| |