In my current work I have a process flow consisting of 20+ nodes. In each node
an error from a service call must be redirected to a specific task node.
This is the test process:
<process-definition xmlns="" name="TestGeneralExceptionHandling">
| <exception-handler>
| <!-- exception-class="...TestBackendException"> -->
| <action name="action1"
| class="....HandleBackendExceptionActionHandler">
| </action>
| </exception-handler>
| <start-state name="start">
| <transition name="" to="DoSomethingWrong"></transition>
| </start-state>
| <node name="DoSomethingWrong">
| <event type="node-enter">
| <action name="action1"
class="...DoSomethingWrongActionHandler">
| </action>
| </event>
| <transition name="" to="succes"></transition>
| </node>
| <task-node name="BackendError"></task-node>
| <end-state name="succes"></end-state>
| </process-definition>
In my code the exception handler performs the following lines of code:
public void execute(ExecutionContext executionContext) throws Exception {
| Node targetNode =
executionContext.getProcessDefinition().getNode("BackendError");
| Token token =
executionContext.getProcessInstance().getRootToken();
| executionContext.setVariable("BackendErrorOriginatingNode",
token.getNode().getName());
| Transition errorTransition = new Transition("errorTransition");
| errorTransition.setTo(targetNode);
| token.signal(errorTransition);
| }
|
As you can see I construct the transition in the code which will be defined at
runtime. This enables me to keep the process flow free of extra transitions
from each node to be drawn.
I wonder if this is a robust way to handle exceptions. We then use a client
application to view the backend error task node and perform corrective actions
on backend systems. Then we will place the token back in the original node
where the error occured and retry that node (all programatically).
Any comments?
Regards,
-- Yuri Vrancken
View the original post :
http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4095526#4095526
Reply to the post :
http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4095526
_______________________________________________
jboss-user mailing list
[email protected]
https://lists.jboss.org/mailman/listinfo/jboss-user