-
1. Re: How to handle an abortion of a work item?
mpiraccini Aug 1, 2011 12:07 PM (in response to francesco.pietrobelli)In my opinion that should be managed by an Interrupting Boundary Event...something like that:
Now, I've clear how to do that with a sub-process...I don't know how to do that with a Task activity.
Indeed, if I want to signal an error or an escalation/compensation I didn't find any good way to do that...Am I missing something?????
-
2. Re: How to handle an abortion of a work item?
mpiraccini Aug 2, 2011 5:08 AM (in response to mpiraccini)Looking at the code, it seems that the way to "raise" an Error/Escalation, etc. from a boundary event is using the signalEvent with the correct "type".
The "type" seems to be specified as the first String part of the "type" parameter in the signalEvent method.
I mean: "Escalation-", "Error-", "Compensate-", etc...
-
3. Re: How to handle an abortion of a work item?
mpiraccini Aug 2, 2011 5:56 AM (in response to mpiraccini)Trying to test what I've written I meet this error (I'm using a generic task, with a userTask the error is similar).
java.lang.ClassCastException: org.jbpm.workflow.core.node.WorkItemNode cannot be cast to org.jbpm.workflow.core.node.CompositeContextNode
at org.jbpm.bpmn2.xml.ProcessHandler.linkBoundaryEvents(ProcessHandler.java:265)
at org.jbpm.bpmn2.xml.ProcessHandler.end(ProcessHandler.java:130)
at org.drools.xml.ExtensibleXmlParser.endElement(ExtensibleXmlParser.java:414)
It seems that it's not yet supported to have a Boundary Event in a Task (even if it should be possible for BPMN2). Can you confirm that, or I'm missing something?
-
4. Re: How to handle an abortion of a work item?
eaa Aug 4, 2011 5:11 AM (in response to mpiraccini)The last thing I remember is that in jBPM5 was not (yet) possible to define a boundary event to an Activity. It needs to be attached to a Subprocess. I'm not sure if adding a boundary event to a Task is now supported, but from what I see, it is not.
-
5. Re: How to handle an abortion of a work item?
mpiraccini Sep 22, 2011 11:09 AM (in response to francesco.pietrobelli)I don't know if JBPM-3319 will be fixed (it's a big issue form me, since I don't know how to manage a aborted workitem situations without a subprocess). Anyway, looking at the code, when a WorkItemManager.abortWorkItem is esecuted, an event is sent to the process instance:
processInstance.signalEvent("workItemAborted", workItem);
So when (and if...) the boundary events for the task will be supported, it should work simply with a "catch" event from the task.
Am I wrong?
-
6. Re: How to handle an abortion of a work item?
davesomebody Sep 22, 2011 9:50 PM (in response to mpiraccini)Funny, this just became important to me.
How would one learn of an aborted workitem?
I've been stepping through jBPM code watching what it does looking for a clue of how to detect this happened from the afterProcessCompleted call. From the org.jbpm.workflow.instance.node.WorkItemNodeInstance the workItemAborted and workItemCompleted methods are exactly alike. The data indicating that the work item has been aborted is tossed and triggerComplete is called on the work item exactly the same way if the work item completed successfuly or aborted. In fact the process instance appears to go about its' business like the work item has really completed normally.
Or for that matter, if something goes horribly wrong from a work-item, is there a way to get the process state set to aborted so I can detect it from a ProcessCompletedEvent? WorkitemManager is pretty limited in options: abortWorkItem, completeWorkItem, registerworkItemHandler,
Is there some tract of the work item having aborted on the NodeInstance or ProcessInstance?
I stumbled into a solution that works for me:
getWorkItemManager() on the statefuleknowledgesession really returns a DefaultWorkItemManager. That one allows you to pull up the WorkItem based on the id of the WorkItem. From there you can grab the process instance id. With that you can call abortProcessInstance on session with the process instance id from the WorkItem. That causes the state of the process instance to be set to WorkflowProcessInstance.STATE_ABORTED and afterProcessCompleted gets called.
-
7. Re: How to handle an abortion of a work item?
tchristensen Dec 1, 2011 12:41 PM (in response to francesco.pietrobelli)There still seems to be no answer to this. When reading through the documentation and looking at the sample code, there isn't anything pointing out how to abort a workflow. In fact if you follow, what I regard as the straight forward solution (listed below) the flow isn't interrupted at all.
I have a flow with two tasks that each is mapped to a WorkItemHandler. If I in my first WorkItemHandler implementation call
workItemManager.abortWorkItem(workItem.getId());
I would assume that the second handler would not be called - but it does. Actually the whole flow is completed.
Can someone explain how to abort a workflow and when the above method call is useful, if not for exactly that?
Do I need to add other elements to my bpmn 2.0 flow? I have one start event, two tasks and one end event. All connected in a lineary fashion.
-
8. Re: How to handle an abortion of a work item?
tchristensen Dec 1, 2011 1:35 PM (in response to francesco.pietrobelli)I have added a simple example - a workflow going from start, over two tasks to end. The first task is a custom workitemhandler that always fails. The executing flow does however, reach the second task that just prints "hello world". See attachment.
-
AbortingFlow.zip 5.3 KB
-
-
9. Re: How to handle an abortion of a work item?
newbird Jul 25, 2012 1:31 AM (in response to tchristensen)Thank yoy very much for your example code...It helped me a lot....
-
10. Re: How to handle an abortion of a work item?
tchristensen Jul 25, 2012 1:42 AM (in response to newbird)How did the source code help? Does it now abort or does it execute all the way through? In case of the latter, this issue still exist: how to abort a workflow?
-
11. Re: How to handle an abortion of a work item?
newbird Jul 25, 2012 1:52 AM (in response to tchristensen)I am just looking for how to define the task name with work item handler...Till now, i was not aware of that...............
Can you please clarify below questions?
- Any idea about JBPM scalability? Can i run jbpm in two servers? If, how do they share load?
- When i register a work item handler, will it execute the execute method immediately or Do i need to confihure anywhare when to invoke the handler?
-
12. Re: How to handle an abortion of a work item?
eodsf Nov 14, 2012 6:30 PM (in response to tchristensen)Hi tchristensen,
No resolution on this I assume ? I'm running into the same issue as you, and seeing the same behavior as you ... would be nice to know if this was a bug that will be fixed, or if there is an alternative way to abort a work item; in my case, all I want to ensure is that the path for that work item isn't marked as complete, and that it can be rettied (I don't want the whole workflow process to abort).
If you found any workaround I'd appreciate hearing about it.
Thanks
-
13. Re: How to handle an abortion of a work item?
joshwa Nov 14, 2012 6:34 PM (in response to francesco.pietrobelli)I believe as of 5.3 jBPM supports boundary events on tasks, so you'll be able to signal an abort which should cancel the workitem.