cancel
Showing results for 
Search instead for 
Did you mean: 

cancel a process outside of the process

supreme06
Champ in-the-making
Champ in-the-making
Hello,
I'm running Seam 2 and Activiti 5.18
I need to create and execute a long asynchonous workflow, during the process, the user should be able to cancel the execution of the workflow (from a JSF page, outside scope of the process)
Whenn the process is running, I tried to call the suspendProcessInstanceById and deleteProcessInstance methods of RuntimeService but they have no incidence on the current runing worflow, I mean the processinstance END_DATE is correctly flagged in the db but the process continue.

Here is the code

processEngine = seamConfiguredProcessEngine.getProcessEngine();
RuntimeService runtimeService = processEngine.getRuntimeService();
pack.setStatus("Cancelled");
packageDao.merge(pack);
runtimeService.setVariable(pack.getJbpmProcessId(), "pack", pack);
runtimeService.suspendProcessInstanceById(pack.getJbpmProcessId());
runtimeService.deleteProcessInstance(pack.getJbpmProcessId(), "deleteReason");

As the process continue, I changed the nodes of the workflow to first get the pack object, check the status and execute my code only if the status is not "Cancelled"

I guess the process keep the variable in cache, because the object I load from the context do not contain the status Cancelled I set previously, and even if I reload the entity using the entityManager (I can see the updated value in the db througt phpMyAdmin).

How can I stop a process or change the values of the entities of a running process when i am outside of this async process?

Thank you
1 REPLY 1

martin_grofcik
Confirmed Champ
Confirmed Champ
Hi,

How can I stop a process


org.activiti.engine.test.api.runtime.RuntimeServiceTest#testDeleteProcessInstance

change the values of the entities of a running process when i am outside of this async process?

org.activiti.engine.test.api.runtime.RuntimeServiceTest#testSetVariables
In activiti source.

Regards
Martin