====== A subprocess and a control branch may be used as an alternative to the attached event ====== {{tag>subprocess event attached_event terminate_event}} Use a subprocess containing the control branch to implement versatile event processing logic. ===== ✔ How to ===== Let's assume that we need to obtain payment from the client, watch the payment due date and talk with the customer in case of delay. Use the following technique: - Put the "Obtain payment" task into subprocess. - Start the subprocess with the parallel gateway followed by two branches, "working" and "control". - Put the "Obtain payment" at the working branch. - Put the timer at the control branch. - End both the working and control branch with the terminate event. Flow_0c37d4z Flow_0c37d4z Flow_05uwose Flow_1yoh8c2 Flow_05uwose Flow_0xinlw8 Flow_0tjh6sh Flow_0vj1spf Flow_1yoh8c2 Flow_1fpmuu7 Flow_0tjh6sh Flow_0xinlw8 Flow_0vj1spf Flow_0v7giyt Flow_0v7giyt Flow_0xssdyb Flow_1fpmuu7 Flow_0xssdyb ===== ✘ How NOT to ===== Interrupting attached timer won't let discussing the issue with client while still trying to obtain the payment: Flow_1mqvexf Flow_0b5yo8b Flow_1mqvexf Flow_0b5yo8b Flow_0xmx632 Flow_0xmx632 Non-interrupting looks better but it won't let resetting the timer to the new due date: Flow_1mqvexf Flow_0b5yo8b Flow_1mqvexf Flow_1fkn8r9 Flow_1fkn8r9 Flow_0gsynar Flow_0gsynar Flow_0jzxjdu Flow_16a0qq5 Flow_0jzxjdu Flow_16a0qq5 Flow_0b5yo8b ===== Notes ===== - 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. - As an exception to the [[en:rule:explicit_parallel_split|general rule]], one may initiate work and control flows directly from the start event: Flow_1qbujp7 Flow_1v8e8eg Flow_1qbujp7 Flow_0xinlw8 Flow_0tjh6sh Flow_0vj1spf Flow_1fpmuu7 Flow_1v8e8eg Flow_0tjh6sh Flow_0xinlw8 Flow_0vj1spf Flow_0v7giyt Flow_0v7giyt Flow_0xssdyb Flow_1fpmuu7 Flow_0xssdyb ===== See also ===== * [[en:rule:event_gateway_warning]] ===== Autor(s) ===== --- //[[user:bell|Anatoly Belaychuk]] 2023-09-10 11:21//