====== Use conditional event to model collaboration ======
{{tag>collaboration conditional_event message_event intermediate_event}}
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 =====
Flow_09aipy9
Flow_09aipy9
Flow_16kqfso
Flow_16kqfso
Flow_1s33fqb
Flow_008j1br
Flow_1s33fqb
Flow_1ins0qh
Flow_1lsywu4
DataStoreReference_1o133y4
Flow_008j1br
Flow_1ins0qh
Flow_1lsywu4
Flow_0bg3trg
Flow_1wyen10
Flow_1wyen10
Flow_165lj3o
Flow_0ea0g86
Flow_165lj3o
Flow_0bg3trg
Flow_0ea0g86
Flow_1xejeiu
Flow_0uoc8i4
Flow_1xejeiu
Flow_0uoc8i4
Flow_1w0i707
Flow_1j3yt6b
Flow_1j3yt6b
Flow_12i57do
DataStoreReference_1o133y4
Property_1irqq7e
Flow_12i57do
Flow_0kxrz4w
Flow_081u6je
Flow_0kxrz4w
Flow_081u6je
Flow_0pavqii
DataStoreReference_1o133y4
Flow_0pavqii
Flow_1w0i707
for each item
===== ✘ How NOT to =====
Flow_09aipy9
Flow_09aipy9
Flow_16kqfso
Flow_16kqfso
Flow_1s33fqb
Flow_008j1br
Flow_1s33fqb
Flow_1ins0qh
Flow_1lsywu4
DataStoreReference_1o133y4
Flow_008j1br
Flow_1ins0qh
Flow_1lsywu4
Flow_0bg3trg
Flow_1wyen10
Flow_0bg3trg
Flow_0ea0g86
Flow_1wyen10
Flow_165lj3o
Flow_0ea0g86
Flow_165lj3o
Flow_1w0i707
Flow_1xejeiu
Flow_0uoc8i4
Flow_1xejeiu
Flow_0uoc8i4
Flow_1w0i707
Flow_1j3yt6b
Flow_1j3yt6b
Flow_12i57do
DataStoreReference_1o133y4
Property_1irqq7e
Flow_12i57do
Flow_0kxrz4w
Flow_081u6je
Flow_081u6je
Flow_0kxrz4w
for each item
===== Notes =====
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.
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.
The conditional event eliminates this dependency.
Now the processes don't need to know anything about each other's internals, only 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:
Flow_158maf0
Flow_0kylthe
Flow_14u27z9
Flow_0kylthe
Flow_1afx0lh
Flow_14u27z9
Flow_1afx0lh
Flow_158maf0
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 =====
* [[external_event]]
* [[event_gateway_warning]]
* [[collapsed_subprocess]]
* [[single_process]]
===== Author(s) =====
--- //[[user:bell|Anatoly Belaychuk]] 2024-08-28 19:36//