AnsweredAssumed Answered

Multiple receive tasks waiting for signal at the same time

Question asked by kenrobrt on Jul 8, 2015
Latest reply on Jul 9, 2015 by trademak

I use Activiti + Camel in my program. Simply put the program is a "form signing application" where I have a form that needs to be signed by a group of people. When everyone has signed the form, the signed form is archived and we're done.

So in my BPMN diagram, I fetch the contact email of one person, then use parallel gateway which goes to fetch next person's contact details and which creates a subprocess. Subprocess has a receive task which waits for a message that person has signed the form. When person signs, subprocess is killed and we mark that person has signed the form.

So if there's person A, B and C, then 3 subprocess have been created and 3 receive tasks wait for a signal that form has been signed. So when one person signs the form, I call the receive task from Camel like this:

<to uri="activiti:SigningProcess:WaitForNotificationForSignatureTask"/>

Problem is that I get the following exception:
ActivitiException: Query return 3 results instead of max 1.

So I guess it does that because there's 3 receive tasks waiting for a message and when I call the task, Activiti gets confused which 3 of them I'm calling. My program logic doesn't really care which one of them I'm calling so I'd like to arbitrarily call one of them and move on, is this possible?