Parallel execution

This example presents a way to design a process which executes two operations (activities) in parallel, the second operation depending on the first one.

My use case:

  • The process has to generate reports (operation A).
  • Generated reports have to be pushed to Alfresco CMS (operation B)
  • The process must not wait on operation B to be finished before execution operation A for the next element.
  • The process must not wait on operation A to be finished for all elements before starting operation B for the same element.
  • Both operations must be executed in parallel but operation B can only be executed on an element when operation A is finished for that element.

My approach:

  • AND Gateway for parallel execution
  • Two queues to manage elements
  • QueueA contains the elements that have not been processed by operation A yet.
  • QueueB contains the elements that have been processed by operation A but not by operation B yet
  • Operation A iterates on queueA and process elements.
  • When Operation A is finished with an element, that element is added to queueB and operation A processes with next element
  • Operation B waits for elements on queueB and process them.
  • When both queues are empty, the process can continue (gateway condition).

I hope that this process could be re-used for other purposes.
If there is any other solution that fulfills my requirements, I would be more than happy to know it :wink:
Repository URL : http://community.bonitasoft.com/project/parallel-execution