Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Next revision
Previous revision
en:rule:conditional_event_collaboration [2024-08-28 18:05] – created Anatoly Belaychuken:rule:conditional_event_collaboration [2024-08-28 20:56] (current) – [See also] Anatoly Belaychuk
Line 1: Line 1:
-====== 0-TBD Use conditional event to model collaboration ======+====== Use conditional event to model collaboration ======
  
-{{tag>conditional_event message_event intermediate_event}} +{{tag>collaboration conditional_event message_event intermediate_event}}
- +
-{{en:underconstruction.png?nolink&200|}} +
- +
-Short description.+
  
 +The message event creates a tight connection between processes: the sender process must know the internals of the receiver.
 +The conditional event allows more practical loosely coupled process architecture.
 ===== ✔ How to ===== ===== ✔ How to =====
  
Line 513: Line 511:
         <omgdc:Bounds x="962" y="202" width="36" height="36" />         <omgdc:Bounds x="962" y="202" width="36" height="36" />
         <bpmndi:BPMNLabel>         <bpmndi:BPMNLabel>
-          <omgdc:Bounds x="953" y="178" width="54" height="14" />+          <omgdc:Bounds x="953" y="253" width="54" height="14" />
         </bpmndi:BPMNLabel>         </bpmndi:BPMNLabel>
       </bpmndi:BPMNShape>       </bpmndi:BPMNShape>
Line 575: Line 573:
         <omgdi:waypoint x="1052" y="140" />         <omgdi:waypoint x="1052" y="140" />
       </bpmndi:BPMNEdge>       </bpmndi:BPMNEdge>
 +      <bpmndi:BPMNShape id="DataStoreReference_1o133y4_di" bpmnElement="DataStoreReference_1o133y4">
 +        <omgdc:Bounds x="765" y="325" width="50" height="50" />
 +        <bpmndi:BPMNLabel>
 +          <omgdc:Bounds x="679" y="343" width="76" height="14" />
 +        </bpmndi:BPMNLabel>
 +      </bpmndi:BPMNShape>
       <bpmndi:BPMNShape id="Participant_0pfnmlo_di" bpmnElement="Participant_0pfnmlo" isHorizontal="true">       <bpmndi:BPMNShape id="Participant_0pfnmlo_di" bpmnElement="Participant_0pfnmlo" isHorizontal="true">
         <omgdc:Bounds x="370" y="410" width="761" height="260" />         <omgdc:Bounds x="370" y="410" width="761" height="260" />
-        <bpmndi:BPMNLabel /> 
-      </bpmndi:BPMNShape> 
-      <bpmndi:BPMNShape id="TextAnnotation_1l2chg1_di" bpmnElement="TextAnnotation_1l2chg1"> 
-        <omgdc:Bounds x="1050" y="590" width="61" height="44" /> 
         <bpmndi:BPMNLabel />         <bpmndi:BPMNLabel />
       </bpmndi:BPMNShape>       </bpmndi:BPMNShape>
Line 640: Line 640:
         <omgdi:waypoint x="962" y="495" />         <omgdi:waypoint x="962" y="495" />
       </bpmndi:BPMNEdge>       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNEdge id="Association_12k4a5n_di" bpmnElement="Association_12k4a5n"> +      <bpmndi:BPMNShape id="TextAnnotation_1l2chg1_di" bpmnElement="TextAnnotation_1l2chg1"> 
-        <omgdi:waypoint x="1030" y="587" /> +        <omgdc:Bounds x="1050" y="590" width="61" height="44" /> 
-        <omgdi:waypoint x="1050" y="592" /> +        <bpmndi:BPMNLabel /> 
-      </bpmndi:BPMNEdge>+      </bpmndi:BPMNShape>
       <bpmndi:BPMNEdge id="Flow_1w0i707_di" bpmnElement="Flow_1w0i707">       <bpmndi:BPMNEdge id="Flow_1w0i707_di" bpmnElement="Flow_1w0i707">
         <omgdi:waypoint x="1030" y="538" />         <omgdi:waypoint x="1030" y="538" />
Line 656: Line 656:
         <omgdi:waypoint x="640" y="538" />         <omgdi:waypoint x="640" y="538" />
       </bpmndi:BPMNEdge>       </bpmndi:BPMNEdge>
-      <bpmndi:BPMNShape id="DataStoreReference_1o133y4_di" bpmnElement="DataStoreReference_1o133y4"> +      <bpmndi:BPMNEdge id="Association_12k4a5n_di" bpmnElement="Association_12k4a5n"> 
-        <omgdc:Bounds x="765" y="325" width="50" height="50" /> +        <omgdi:waypoint x="1030" y="587" /> 
-        <bpmndi:BPMNLabel> +        <omgdi:waypoint x="1050" y="592" /> 
-          <omgdc:Bounds x="679" y="343" width="76" height="14" /+      </bpmndi:BPMNEdge>
-        </bpmndi:BPMNLabel+
-      </bpmndi:BPMNShape>+
       <bpmndi:BPMNEdge id="DataOutputAssociation_17kcwns_di" bpmnElement="DataOutputAssociation_17kcwns">       <bpmndi:BPMNEdge id="DataOutputAssociation_17kcwns_di" bpmnElement="DataOutputAssociation_17kcwns">
         <omgdi:waypoint x="790" y="180" />         <omgdi:waypoint x="790" y="180" />
Line 681: Line 679:
 ===== Notes ===== ===== Notes =====
  
-  * Extra comments (optional)+There is no significant difference between two models as long as excactly one process issues invoices. 
 +The event-message scheme may look preferable since it more clearly shows the collaboration mechanism.
  
-===== Exceptions =====+The situation changes if that the company has different sales processes for different product lines (goods, services) or channels (retail, partner, online). 
 +In this case, the logic of the bank statement processing process becomes too complicated: 
 +it will need a gateway to send a message to the process from which this specific invoice has come. 
 +If a new variation of sales process emerges, the statement processing process should be modified.
  
-  * Exceptionsif any+The conditional event eliminates this dependency. 
 +Now the processes don't need to know anything about each other's internalsonly about the datastore serving as the the common interface:
  
 +* the client process (Order to pay) adds a record to the database table (Invoices) and waits until the value of the "status" field of this record changes to the required one (paid)
 +* the server process (Bank statement processing) searches the database table for the record to which the payment refers, and changes the status to "paid"
 +* the client process awakens and continues working
 +
 +There may be unlimited number of client and server processes.
 +
 +In the case of an executable process model, the event message will be automatically processed by the engine.
 +If the process engine does not support a conditional event, it can be easily replaced with a combination of an exclusive gateway and a timer:
 +
 +<bpmnio type="bpmn">
 +<?xml version="1.0" encoding="UTF-8"?>
 +<definitions xmlns="http://www.omg.org/spec/BPMN/20100524/MODEL" xmlns:bpmndi="http://www.omg.org/spec/BPMN/20100524/DI" xmlns:omgdc="http://www.omg.org/spec/DD/20100524/DC" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:di="http://www.omg.org/spec/DD/20100524/DI" id="sid-38422fae-e03e-43a3-bef4-bd33b32041b2" targetNamespace="http://bpmn.io/bpmn" exporter="http://bpmn.io" exporterVersion="0.10.1">
 +  <process id="Process_1" isExecutable="false">
 +    <exclusiveGateway id="Gateway_04akzo7" name="Invoice status is &#39;paid&#39;?">
 +      <incoming>Flow_158maf0</incoming>
 +      <outgoing>Flow_0kylthe</outgoing>
 +      <outgoing>Flow_14u27z9</outgoing>
 +    </exclusiveGateway>
 +    <task id="Activity_03e92gq" name="...">
 +      <incoming>Flow_0kylthe</incoming>
 +    </task>
 +    <sequenceFlow id="Flow_0kylthe" name="yes" sourceRef="Gateway_04akzo7" targetRef="Activity_03e92gq" />
 +    <task id="Activity_0t18jdq" name="...">
 +      <outgoing>Flow_1afx0lh</outgoing>
 +    </task>
 +    <intermediateCatchEvent id="Event_1dsja6c">
 +      <incoming>Flow_14u27z9</incoming>
 +      <incoming>Flow_1afx0lh</incoming>
 +      <outgoing>Flow_158maf0</outgoing>
 +      <timerEventDefinition id="TimerEventDefinition_0s6iums" />
 +    </intermediateCatchEvent>
 +    <sequenceFlow id="Flow_14u27z9" name="no" sourceRef="Gateway_04akzo7" targetRef="Event_1dsja6c" />
 +    <sequenceFlow id="Flow_158maf0" sourceRef="Event_1dsja6c" targetRef="Gateway_04akzo7" />
 +    <sequenceFlow id="Flow_1afx0lh" sourceRef="Activity_0t18jdq" targetRef="Event_1dsja6c" />
 +  </process>
 +  <bpmndi:BPMNDiagram id="BPMNDiagram_1">
 +    <bpmndi:BPMNPlane id="BPMNPlane_1" bpmnElement="Process_1">
 +      <bpmndi:BPMNShape id="Gateway_04akzo7_di" bpmnElement="Gateway_04akzo7" isMarkerVisible="true">
 +        <omgdc:Bounds x="255" y="105" width="50" height="50" />
 +        <bpmndi:BPMNLabel>
 +          <omgdc:Bounds x="241" y="162" width="79" height="27" />
 +        </bpmndi:BPMNLabel>
 +      </bpmndi:BPMNShape>
 +      <bpmndi:BPMNShape id="Activity_03e92gq_di" bpmnElement="Activity_03e92gq">
 +        <omgdc:Bounds x="360" y="90" width="100" height="80" />
 +        <bpmndi:BPMNLabel />
 +      </bpmndi:BPMNShape>
 +      <bpmndi:BPMNShape id="Activity_0t18jdq_di" bpmnElement="Activity_0t18jdq">
 +        <omgdc:Bounds x="30" y="90" width="100" height="80" />
 +        <bpmndi:BPMNLabel />
 +      </bpmndi:BPMNShape>
 +      <bpmndi:BPMNShape id="Event_1qdilzi_di" bpmnElement="Event_1dsja6c">
 +        <omgdc:Bounds x="182" y="112" width="36" height="36" />
 +      </bpmndi:BPMNShape>
 +      <bpmndi:BPMNEdge id="Flow_0kylthe_di" bpmnElement="Flow_0kylthe">
 +        <di:waypoint x="305" y="130" />
 +        <di:waypoint x="360" y="130" />
 +        <bpmndi:BPMNLabel>
 +          <omgdc:Bounds x="324" y="112" width="17" height="14" />
 +        </bpmndi:BPMNLabel>
 +      </bpmndi:BPMNEdge>
 +      <bpmndi:BPMNEdge id="Flow_14u27z9_di" bpmnElement="Flow_14u27z9">
 +        <di:waypoint x="280" y="105" />
 +        <di:waypoint x="280" y="70" />
 +        <di:waypoint x="200" y="70" />
 +        <di:waypoint x="200" y="112" />
 +        <bpmndi:BPMNLabel>
 +          <omgdc:Bounds x="293" y="73" width="13" height="14" />
 +        </bpmndi:BPMNLabel>
 +      </bpmndi:BPMNEdge>
 +      <bpmndi:BPMNEdge id="Flow_158maf0_di" bpmnElement="Flow_158maf0">
 +        <di:waypoint x="218" y="130" />
 +        <di:waypoint x="255" y="130" />
 +      </bpmndi:BPMNEdge>
 +      <bpmndi:BPMNEdge id="Flow_1afx0lh_di" bpmnElement="Flow_1afx0lh">
 +        <di:waypoint x="130" y="130" />
 +        <di:waypoint x="182" y="130" />
 +      </bpmndi:BPMNEdge>
 +    </bpmndi:BPMNPlane>
 +  </bpmndi:BPMNDiagram>
 +</definitions>
 +</bpmnio>
 +
 +In the case of a non-executable model, the conditional event models an employee periodically pressing the F5 key 
 +on the automated system page displaying a list of issued invoices together with status.
 +
 +===== Exceptions =====
 +
 +Collaboration via event message is acceptable if it involves exactly two processes.
 ===== See also ===== ===== See also =====
  
-  * References to similar rules (optional)+  * [[external_event]] 
 +  * [[event_gateway_warning]] 
 +  * [[collapsed_subprocess]] 
 +  * [[single_process]]
  
 ===== Author(s) ===== ===== Author(s) =====
  
-Signature + --- //[[user:bell|Anatoly Belaychuk]] 2024-08-28 19:36//