cancel
Showing results for 
Search instead for 
Did you mean: 

CallActivity without waiting for subprocess to finish

djanca
Champ in-the-making
Champ in-the-making
Hi all,
we would need to design following process. A main process containing exclusive gateway to decide what branch (flow) to follow, each decision branch will contain only CallActivity element starting external process. So far so good and everything works fine, but we would like to reach behaviour that the main decision making process will finish immediately after starting external process. It means to behave like a chain of processes. At the moment the main process waits until the subprocess ends.

Is there a way to define such a process in Activiti?

thanx for any hint
6 REPLIES 6

trademak
Star Contributor
Star Contributor
Sure, you can use an async continuation on the call activity. You can do this by adding a async="true" attribute.

Best regards,

djanca
Champ in-the-making
Champ in-the-making
thanx for your reply.

I've tried it and doesn't seem to work in expected way.

My test case:
1) I designed simple process containing only ReceiverTask (and start, end events of course Smiley Happy)
2) I created main process containing start, end events and CallActivity task configured to call external process from point 1 and activiti:async parameter set to true.

3) I started main process from point 2
4) The complete process flow stopped in following situation: main process (point 2) shows CallActivity task as an active one and 'subprocess' (from point 1) shows ReceiverTask as an active one.

This state fits to the Activiti documentation I think. The asynchronous execution means that once process flow reaches any element with async=true, the client thread returns with 'response', but process flow (in activiti engine context) continues in synchronous execution. As far as I understood it, this 'async' parameter modifies way when client thread returns back to client of a WF engine, not the way how CallActivity task executes its subprocess. But maybe I misunderstood something.

I would need to reach following state in the situation described above. When subprocess from point 1 is called by 'async' CallActivity task from main process (point 2), the subprocess is started and waits for message in its ReceiverTask, but the main process continues immediately and correctly finishes. It means only 1 process instance has to be active.

thanx for any help or advice

trademak
Star Contributor
Star Contributor
Hi,

Okay right. The main process instance can't finish while the sub process is still running.
An alternative approach would be to start a new process instance from a service task in the main process.
Then the service task will continue when the receive task is created and the main process will finish.

Best regards,

djanca
Champ in-the-making
Champ in-the-making
Aah, yes. Good idea.

thanx a lot for your advice.

djanca
Champ in-the-making
Champ in-the-making
one more question.

when this kind of behavior/feature is not supported by activiti engine out of the box, can not I face any other problems or side effects? I mean, when this 'asynchronous' execution of subprocesses is not supported by CallActivity task directly and I will implement it as a custom ServiceTask, can not it be something against some activiti general ideas and concepts?
just to be sure I will not face any other related, conceptual problem in near future Smiley Happy

thanx a lot anyway

trademak
Star Contributor
Star Contributor
Hi,

No I don't think you will encounter side effects.
The reason that the call activity doesn't work this way is that the sub process should be completed before the call activity can be considered completed.

Best regards,