I have a scenario where I am suppose to delete the processInstance if triggered externally. so when any task is going on let’s say connector call is waiting for the response from other application (which is around 45-60 secs). So when i try to delete it does get deleted but the execution continues untill async task met.
i don’t want to delete all the processinstances for that process-definition. The deletion would happen on a single process instance currently i am using runtimeService.deleteProcessInstance() java API, It does delete the process instance but it executes all the tasks till endEvent or any async task met. I am having a rest call which takes a lot of time to get the response, meanwhile if the user triggers Delete on that, it does get deleted but when the response comes back that time it will execute the whole process.
Would that stop my connector rest call execution? Let me try this one.
I used runtimeService.deleteProcessInstance(processInstanceId, “User Cancel”,true,true,true,false) before.
I tried, it did not work. see find my test model attached, it has a thread sleep task. During the sleep task, try to delete the process instance by starting delete process (pass process instan ce id) test1.bpmn (8.3 KB))
This will try to delete own instance, which will fail.
Process to process deletion is handled in different way. You need to query by businesskey for process instance or if you know the process instance Id of that process instance and then pass that process instance id as the argument for the delete function to do the delete operation.
Correct. I don’t want to delete own process Instance. I hope you understood that part. It is not about how i am fetching the processInstanceId, at the end it is to delete the process instance using
I think you have not understood my question. The question is while deleting the process instance if there are no ASYNC tasks it executes the process further in a synchronous way where as the process instance is deleted. Would you be able to replicate the scenario? Try thread sleep or try connector and hold the rest call in Debug mode.