cancel
Showing results for 
Search instead for 
Did you mean: 

Dynamic fork

mreiterer
Champ in-the-making
Champ in-the-making
Hi all,

i have the following requirements (see my process in the attachment):

- The "Render" step calls an external resource via REST.
- The external system delivers x (unknown number) request which contain a file reference which should then be handled/stored in parallel.
  -> My solution is to call messageEventReceived for every on the boundary message event and do a callActivitiy in the concurrent flow.

-  Then the external system delivers a success message.
  -> upon delivery of the success message i do a signal on the wait state (Wait for render result).

- The boundary message event is configured as "cancel activitiy = false"

My current problem is that i get an ActivitiOptimisticLockingException, on messageEventReceived.

Is there a best practice how to model such an requirement?


Thanks
Markus



6 REPLIES 6

mreiterer
Champ in-the-making
Champ in-the-making
how do i add a png attachment ?

mreiterer
Champ in-the-making
Champ in-the-making

jbarrez
Star Contributor
Star Contributor
So basically you have multiple threads hitting the same receive task at the same time, right?
One option would be to use a multi instance receive task, potentially using an embedded subprocess with multi instance so you can correlate the execution id when you're request is sent back to Activiti.

mreiterer
Champ in-the-making
Champ in-the-making
Yes. Don't i have to know the exact number of incoming messages / threads for multi-instance ?

jbarrez
Star Contributor
Star Contributor
So how do you know in that case when to stop?

mreiterer
Champ in-the-making
Champ in-the-making
I get a "completed" message at the end. I already have a solution now. I have implemented a loop consisting of a message gateway and a parallel gateway.