if i understand your intentions is you want some kind of action to be taken up when a workflow fails (notification), but dont want the notification for all intermintent failues but only when the workflow fails permanently (activity/workflow do not get resubmitted etc)
so, if workflow 1 spaws workflow 2 and workflow 3, and workflow 2 fails, (workflow 1 could actually spawn wf2 again as continue as new )… so its for workflow 1 to determine when to send notification or not.
if you are reusing the workflows (say workflow 2) is independent workflow but gets embedded in workflow 1 as well, then you can always use workflow.parent kind of api to figure out if workflow 2 needs to send notification or, should it let workflow 1 manage the notification…
so net net, in your scenario the parent process/workflow should manage the notification… sub workflows should mute them self up when managed through a parent…
so i am thinking of something like this
Workflow2 {
execute(){
//last step is to send notification
if(workflow.parent ==null) //indedpent workflow
{
/notify
}
}
}
workflow1 {
execute() {
childworflow2.execute();
//notifiy
if(wf.parent ==null)
{
//notifiy
}
}
}
so , my proposal is check workflow.parent before notification, and if parent is null send notification, if its not null , let parent determine what to do…
just like you handle exception , if there is no catch block, it will get rolled up to parent…