cancel
Showing results for 
Search instead for 
Did you mean: 

Interacting with a running process

jorell
Champ in-the-making
Champ in-the-making
I have a unique use case I was hoping someone here could help me with. I have a process with a multiInstanceLoop that loops over a variable objects and calls a call activity for each item in the object list. The problem is that the object list is not static, and we get new object during the life of the process. Is there a way I can interact with my process while its running and give it a new batch of objects to process? I want to launch new call activities for the new objects but still keep the parent child relation ship (so the new processes are children of the original process for reporting purposes).
I looked at the intermediateCatchEvent if I could have the process with a always waiting intermediateCatchEvent right before the multiInstanceLoop (along with the regular path), I could always signal the process and update the object list and re-invoke the multiInstanceLoop. I know this is not possible currently, but I was hoping there is some other mechanism to accomplish this.

Another way to solve this would be if I could launch a new child process but let activiti know to treat a certain process A as its parent.
4 REPLIES 4

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Jorell,

I did not try it, but could it be done in the following way:


Start  —->  Exclusive gateway  — (is list empty) —> End
                 /\          |
                  |          |
                  |          \/
                  |  call process with removed
                  |        item from the list
                  |           |
                  |           |
                  |_____________|
Regards
Martin

jorell
Champ in-the-making
Champ in-the-making
(It would be great if we could attach images here..)
Thanks for your reply Martin. I assume to call a process with an item in the list and then removing it from the list would require custom logic?
I thought of an alternative way to solve this, shown below:
<code>
                                    parallel gateway ——————-
                                          |    /\                       |
                                          |     |                       |
                                         \/     |                      \/
start  —->  parallel gateway  —> Add New Item             Call Sub process X
                   |                         |                        |
                   |                  (timer |                        |
                   |             boundary    |                        |
                   |             event)        ———-             |
                   \/                                        |        \/
  Call Sub process X for all items                           |
       (multi Instance loop)                                ——> parallel Join ———> End
                        |                                                     /\
                        |                                                      |
                        |                                                      |
                          ————————————————-

</code.

Any comments on whether this looks valid/good?

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi Jorell,

you can try it. I would expect that
<code>
Call Sub process X for all items                           |
       (multi Instance loop)
</code>

will throw an exception (in case if it is sequential) because <code>Add New Item </code>  will modify the same list. In parallel case call subprocess should instantiate only executions for items already existing in the list.

Regards
Martin

jorell
Champ in-the-making
Champ in-the-making
No Add New Item will make a call to an external system and that system will just wait till a new item comes along. If it does that system will reply and pass the new item back. Activiti would then move to the parallel fork and 'Call Sub Process X' for the new Item (not using multiInstance loop and not using the list) and the other path from the fork would loop back and again wait for any other new Item at 'Add New Item'.
The 'Add New Item' has a timer boundary event with a deadline of say 24 hrs. So if the external system doesnt respond until then this task would complete on its own and more the the Parallel Join before the end node.