I see timer (non-interrupting) events are used at some places to send notifications independently. Meaning these notifications will not interrupt the main workflow. Also, main workflow will not wait for completion of these notifications.
However, what if I want to send notifications at multiple stages in workflow without any time condition. How can I create them as asynchronous events?
You can plug ExecutionListener and/or TaskListener handlers into your process definition (either by default/automatically by using a BpmnParseListener in the engine configuration or by hand in the modeler) and then simply write to some dispatch location where the information is picked up and processed asynchronously. For instance, you can use a message broker to make it asynchronous.
These listeners will fire as part of the transactions for the regular execution, so if you want them to be asynchronously handled, you need to build them in a way that they only create the work to be done (such as placing them on a message queue/topic), but don’t execute the sending themselves.
Another way is to add a custom history backend and act on particular events to do an async send somehow.
Note by the way, that it’s not entirely true that the main workflow will not wait on non-interrupting timers. It simply means that the activity they are placed on is not “cancelled” when they trigger and thus can be completed. However, the process instance or the subprocess they are inside of WILL wait for all of the spawned branches to complete before completing itself, unless there is also an interrupting event or terminate end event somewhere that triggers and causes them to be cancelled.
Thanks for your detailed response. Having execution listeners and publishing the email notifications to a topic would address the requirement.