I setup a business process which includes a custom workItem; I want the business process to sop when a particular condition occurs, so in this case I call the abortWorkItem method, whose implementation is very simple (ksession is an instance variable set while registering the wotkitem
public void abortWorkItem(WorkItem workItem, WorkItemManager manager) {
ksession.abortProcessInstance(workItem.getProcessInstanceId());
}
Everything works fine if I start the process from a standalone client, but when I start it from the jbpm console, I have no way to set there the ksession, so an exception is raised; so my question is: how to stop the processInstance when it was started through the console?
what version of jbpm do you use? In 5.4 you can set ksession on workitem handler using configuration file, see details here check the SessionTemplate section.
HTH