cancel
Showing results for 
Search instead for 
Did you mean: 

Create a standalone async service task

mystarrocks
Champ on-the-rise
Champ on-the-rise

Hi, I have a simple process which involves completion of a user task. What I want to add is an asynchronous service task on completion of the user task, but one that would not hold the process from completing. In other words, once the user task is complete, I want the service task to be triggered asynchronously, retried on failures etc., but without affecting the progress of the process this service task implicitly corresponds to.

In a way, while completion of the user task above is set to trigger the service task execution, the service task itself is external to the process. So standalone tasks seem to fit the bill, but it looks there can only be standalone user tasks, not service ones.

Are there any alternatives to achieve what I want here?

6 REPLIES 6

amruta_w
Star Collaborator
Star Collaborator

HI,

Refer these documents it may help you to achieve your use-case:

Activiti User Guide 

Activiti User Guide 

Regards

Amruta Wandakar

Didn't mean to hit "No" on the Helpful, sorry, that was a misclick.

Anyway, it looks like a subprocess won't be enough in my case because the parent process (in this case, my process with the user task) won't terminate until the subprocess/call activity with the service task does, which isn't quite what I want.

pault
Star Contributor
Star Contributor

Would simply marking the service task asynchronous achieve what you are after ?

As described here:

Activiti User Guide 

mystarrocks
Champ on-the-rise
Champ on-the-rise

It wouldn't, would it? A process cannot be completed until all of its tasks are completed, asyc or not, I would imagine? Sure, having a separate asynchronous task after the user task is complete, as opposed to say an end event listener on the process, disconnects the service task work the user work, but the process completion would still depend on the service task work completing normally.

Ah yes, if you want the process to fully complete then it wouldn't help. One other thing I'm trying in a protoype I'm working on for V5.22 is to use the Activiti Java API from within an Execution or Event listener to start another process which then runs totally independently. In my case monitoring processes that are started when particular events occur. Not sure if that sort of approach could work for you.

I should mention though I have been told that using the API directly in this way isn't recommended in certain circumstances, and I have had to use a seperate thread sometimes to avoid issues.

dilip_chenani
Champ in-the-making
Champ in-the-making

Can you share the approach? I am looking for similar solution.

I am working on solution for

1) calling a new Child Process fromn within a Service task of Parent Process.

2) submiting the task form of Child process from a Service task of Parent Process.

Problem i am facing is Child process is not getting commited in database until some user task is present.