View Javadoc
1   /*
2    * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
3    * The software in this package is published under the terms of the CPAL v1.0
4    * license, a copy of which has been included with this distribution in the
5    * LICENSE.txt file.
6    */
7   package org.mule.api.exception;
8   
9   import org.mule.api.MuleEvent;
10  import org.mule.routing.filters.WildcardFilter;
11  
12  /**
13   * Take some action when a messaging exception has occurred (i.e., there was a message in play when the exception occurred).
14   */
15  public interface MessagingExceptionHandler
16  {
17      /**
18       * Take some action when a messaging exception has occurred (i.e., there was a message in play when the exception occurred).
19       * 
20       * @param exception which occurred
21       * @param event which was being processed when the exception occurred
22       * @return new event to route on to the rest of the flow, generally with ExceptionPayload set on the message
23       */
24      MuleEvent handleException(Exception exception, MuleEvent event);
25  
26      /**
27       * Returns the filter that given an exception class will determine if a
28       * transaction should be committed or not.
29       *
30       * @return the exception filter configured for commit of transactions or
31       *         null if there is no filter.
32       */
33      WildcardFilter getCommitTxFilter();
34  
35      /**
36       * Returns the filter that given an exception class will determine if a
37       * transaction should be rollbacked or not.
38       *
39       * @return the exception filter configured for rollback of transactions or
40       *         null if there is no filter.
41       */
42      WildcardFilter getRollbackTxFilter();
43  }
44  
45