1 of 1 people found this helpful
First off, I'd be really asking myself why you cannot use regular Nodes, as these are the exact node type that is intended for this type of work. Without any reason for that, I can't help you on that - but it actually seems the right thing to find out here.
If you want to get out of a TaskNode programmaticaly, leaving the node yourself is not the best way, as this leaves the TaskNode's internal administration in an undefined state (hence the null). What you should do is to call the end() method on the TaskInstance, and allow the TaskNode to close shop itself before moving on.
Hope this helps a bit!
Thanks for the Reply
We tried using node for automatic activities but our application needs to show the history of what path a process execution has taken. With node we did not find any jbpm table which would show the log of executed nodes.
So we took this approach...If u know of any other solution for this please do let me know.
Well, we tried using taskInstance.end() in the Action handler but it gave Null pointer exception since in the handler was being called on a task-create event. Then we tried using the same in the class that implements AssignmentHandler. In this case what happens is that the execution moves ahead from the task till it gets user activity(for which the AssignmentHandler class is not mapped) but the execution starts again from the 1st automatic activity from where we are doing taskInstance.end() and goes in an infinite loop.
public class TaskAssignHandler implements AssignmentHandler
private static final long serialVersionUID = 1L;
public void assign(Assignable assignable, ExecutionContext executionContext)
Thanks a lot!!
Sorry it took a while for me to get back to you...
1) If you need to be able to to show the history of your process executions, process logging (which is different from logging with e.g. Log4J) is something worth while looking at. See chapter 16 of the user guide on how that is done.
If that requirement is the only thing keeping you from using regular Nodes, I strongly recommend you try this and switch to Nodes. It'll make your life much easier!
2) Why the TaskInstance cannot be ended from where you try it isn't completely clear to me. Assignment isn't part of the TaskInstance's lifecycle, so book-keeping should be up-to-date once the creation step is completed - but I'm not completely sure about that in case of the task-created event, to be honest.
I know that it is possible to have an actor ask for the TaskInstances that are assigned to it (that's pretty much by design ), and the ones that are returned can be ended without a problem. I understand that your TaskInstances need to be ended in a way that is more automatic than what originally is intended, but if you must: would polling be an option (i.e. if you find that your event driven doesn't give you the correct result)?