-
1. Re: How to stop a process instance
kukeltje Sep 29, 2009 8:54 AM (in response to fdegrigny)Do you have a unittest that I can run? You do not demonstrate where you want to end the process instance.
And what doe you mean by 'over-complicated'? Nothing from your post points to something that is complicated, let alone over-complicated. It might be a bug, yes, but over-complicated it is not. -
2. Re: How to stop a process instance
fdegrigny Oct 8, 2009 4:56 AM (in response to fdegrigny)Last I found how to do this.
In fact the ProcessIntance.end() method really terminate the process but not all the running process tasks in it (this has confused me).
The process tasks have to be terminated separately.
At last, I have made all my ActionHandlers extends a custom base one :public abstract class BaseActionHandler implements ActionHandler { public void execute(ExecutionContext executionContext) throws Exception { try { doAction(executionContext); } catch (Throwable t) { handleException(t, executionContext); } } public abstract void doAction(ExecutionContext executionContext) throws Exception; protected void handleException(Throwable t, ExecutionContext executionContext) throws Exception { log.fatal("Error in " + this.getClass().getName() + ": " + t.getMessage(), t); //try to stop process instance and associated tasks ProcessInstance processInstance = executionContext.getProcessInstance(); stopProcess(processInstance); throw new JbpmException(t.getMessage(), t); } protected void stopProcess(ProcessInstance processInstance) { JbpmContext jbpmContext = JbpmConfiguration.getInstance().getCurrentJbpmContext(); Collection<TaskInstance> taskInstances = unchekedCast(processInstance.getTaskMgmtInstance().getTaskInstances()); for(TaskInstance task : taskInstances) { if( ! task.hasEnded() ) { task.setSignalling(false); task.cancel(); jbpmContext.save(task); } } processInstance.end(); } }
What I have found over-complicated is the JBPM API itself. I'm working with for few month now and there is many things I still cannot understand. For example, the various variables scopes are very confusing and the semantic of many operations are not very clear.
My customers have very basics needs for their workflows but I have discover that they cannot be done simply with the JBPM API. -
3. Re: How to stop a process instance
kukeltje Oct 8, 2009 5:31 PM (in response to fdegrigny)The api in three was kind of blurry, yes, that is why it was simplified in 4. (But asking is always possible)
various variable scopes? Task local, transient and normal.
If the semantics of the various operations are not clear after working with it for several months I think something else might be wrong.
And a statement likeMy customers have very basics needs for their workflows but I have discover that they cannot be done simply with the JBPM API.
Is like saying there are no obstacles between the earth and the moon, so it should be simple to get there but I do not know how.
What I mean by this is that the problem in reality is not that simple or you lack the knowledge (no offence) to see it. Complex processes can be done with jBPM, see slide 15 of http://www.slideshare.net/tombaeyens/jbpm-community-day-full-scale-stp-with-jbpm.
Tasks not being ended when a process is ended can be changed by setting the end-complete-process attribute on the end state to true.