AnsweredAssumed Answered

NPE While deleting a processInstance

Question asked by vivverma on Aug 29, 2013
Latest reply on Sep 2, 2013 by trademak
Hi,
I have a scenario were i invoke my application's service API from within activiti's ServiceTask. Now in case if the Service API throws an exception, i would like to terminate the processInstance, and also retain the history details as i require it to fetch the status of the workflow at a later point of time using the processInstanceId.
To achieve this I wrapped all the ServiceTask logic inside a try catch block and then whenever an exception occurs i catch the exception and would like to terminate the processInstance using the runtimeService.deleteProcessInstance(pid).

Theoretically i expected  things to work, but Activiti(5.11) throws an NPE @ AbstractBpmnActivityBehaviour.hasCompensationHandler(), Is it an expected behavior? or a bug with activiti?

The issue seems to be similar to the below:-
http://forums.activiti.org/content/npe-511-when-deleting-process-service-task#comment-19035

Could anyone please help me out in achieving the said behavior?

One way which i could think of is to wrap the tasks inside a sub-process and to have an error Boundary event on the sub-process boundary which ends the execution.

Is there any way of triggering an End-Event from within the ServiceTask programmatically ??

Could anyone please guide me in the right direction.

Thanks

Outcomes