How to get a single email event after a parallel process

  • 21 August 2009
  • 2 replies
  • 1 view

Badge +1

I have a process that has up to five parallel paths. In the most common situation all of the paths finish quickly - they call a webservice and nothing goes wrong.


When each of the webservices are called a flag is set on each path to indicate it is done. The paths then rejoin at an activity that I set the preceding rule to require all the flags to be set to True. The process needs to send an e-mail to the originator.


 The problem I am having is dispite my preceding rule I end up sending five e-mails to the originator. It feels like the activities are completing too closely together and so it is running all the tasks at the same time rather than letting each one wind up and the first four getting blocked by the preceding rule.


 Is there a better way to do this? I want to bring the five flows together and when they are all complete fire a single email.


 Thanks in advance for any help you folks have...


2 replies

Badge +5

It sounds like your preceeding rule isn't configured properly.  You could have 100 lines coming into an activity, but until that preceeding rule evaluates to true, the events (i.e. your mail event) in the activity where all the lines come into won't get executed.  Make sure all of the variables you are evaluating in the preceeding rule are in fact what they should be by running the process instance report - data fields.  See the following post:


 http://k2underground.com/forums/post/31200.aspx

Badge +1

Thanks for the help - I'm a bit of a newbie - I've checked the datafields carefully. I did solve the issue by chaining the activites together 2 by 2 rather than having them all converge in a single activity - it's a messy solution though.


For example, we have flows: 1 2 3 4 5


1 and 2 combine than that result and 3 and that result and 4 and that result and 5 - a mess.


 It felt like all five lines were resolving in my activity at the same time until I added the combinations - I don't know how K2 pipelines the flow through a parallel process. Are they truly on separate threads or is it a simple round robin. If it's a round robin I can see how I have the problem because in the base case all five flows have a single activity and each would complete in turn before the preceding rule on the combining activity is ever evaluated.

Reply