[jboss-user] [JBoss jBPM] - Exception-Handler an Transitions

hamtho2 do-not-reply at jboss.com
Tue Jul 15 05:11:25 EDT 2008


Hi @all,

I am calling an Action in a transition as followes


  | <state name="state1">
  | 		<event type="node-enter" >
  | 				<action class="state1ActionHandler" name="request"></action>
  | 		</event>
  | 		
  | 		<transition name="state change" to="isCancelled" ></transition>
  | 		<transition name="invoice" to="invoiced" >
  | 			<action class="InvoicingActionHandler" name="invoice"></action>
  | 		</transition>
  | 	</state>
  | 

As there might occur an Exceptions the InvoicingActionHandler I defined a "global" exception-handler


  | <exception-handler >
  | 		<action name="reroute node" class="ProcessFailedExceptionActionHandler" />
  | 	</exception-handler>
  | 

This exception handler is perfectly called and I set the token to the source node of the transition. 


  | public class ProcessFailedExceptionActionHandler implements ActionHandler {
  |     
  |     private static final Logger log = Logger.getLogger(ProcessFailedExceptionActionHandler.class);
  | 
  |     public void execute(ExecutionContext executionContext) throws Exception {
  |         
  |         Node sourceNode = executionContext.getTransitionSource();
  |         Throwable throwable = executionContext.getException();
  |         
  |         log.info(String.format("Caught exception %s. Re-routing to source node: '%s'", throwable.getMessage(), sourceNode.getName()));
  |         final Token token = executionContext.getToken();
  |         token.setNode(sourceNode);
  |     }
  | }
  | 

Unfortunately the code of the action handler defined as "node-enter"-ActionHandler of the target-node is still called, although I re-route the node manually and it should not enter the initially target node anymore. Is there a way to prevent this behaviour?

Thanks
Thomas

View the original post : http://www.jboss.com/index.html?module=bb&op=viewtopic&p=4164426#4164426

Reply to the post : http://www.jboss.com/index.html?module=bb&op=posting&mode=reply&p=4164426



More information about the jboss-user mailing list