What is the way to stop a task?

HI ,

We have a service which calls an external process and User should have the provision to stop the selected task. Could you please provide any pointers so that when the user selects this task and click stop, on the back end , a signal(SIGINT or some other) should be sent to the extrernal process started from this task .

Thanks in advance Niall.

Thanks
Vamsi

I have some questions

How exactly is this called - is this another process in camunda? Where is this other process

How does the user see the task? Is it something like cockpit of a front end which displays currently active tasks?

Does this ‘stop’ end the process? or trigger an event?

For the Point 1 : This is our custom process. From Camunda groovy script , we call java which executes a shell script(from where it triggers a process in Unix).

For the Point 2 : Yes , For the user it looks like a cockpit, If there are multiple branches and if the user selects a job in one of the branch, only that job should be stopped.

For the Point 3: On clicking stop, the external process which is triggered through shell script from groovy should get stopped

If the process you’re calling in Unix is asynchronous then you’re going to have a hard time stopping it via API with Camunda. Once the call is made camunda will no longer have any control over what is happening in the exteral system - it would be able to cancel the state in Camunda but not affect the other process

Hi Niall,

But is there any way where we can capture the pid of the lanched process from camunda and store it as part of activity or in camunda context?

Thanks
Vamsi

Sure, you could set it as a process variable

Any example code which i can refer Niall?

No problem - there’s a code snippet on how to get and set variables in the docs:
https://docs.camunda.org/manual/latest/user-guide/process-engine/variables/#set-and-retrieve-variables-overview