View Javadoc

    1   package org.codehaus.xfire.fault;
    2
    3   import org.apache.commons.logging.Log;
    4   import org.apache.commons.logging.LogFactory;
    5   import org.codehaus.xfire.MessageContext;
    6   import org.codehaus.xfire.XFireException;
    7   import org.codehaus.xfire.exchange.OutMessage;
    8   import org.codehaus.xfire.handler.AbstractHandler;
    9   import org.codehaus.xfire.handler.Phase;
    10  import org.codehaus.xfire.transport.Channel;
    11
    12  /***
    13   * Sends messages out via the out channel on the message exchange.
    14   *
    15   * @author <a href="mailto:dan@envoisolutions.com">Dan Diephouse</a>
    16   */
    17  public class FaultSender
    18      extends AbstractHandler
    19  {
    20      private static final Log logger = LogFactory.getLog(FaultSender.class);
    21
    22      public String getPhase()
    23      {
    24          return Phase.SEND;
    25      }
    26
    27      public void invoke(MessageContext context)
    28          throws XFireFault
    29      {
    30          Channel faultChannel = context.getExchange().getFaultMessage().getChannel();
    31
    32          try
    33          {
    34              // TODO: Check if this is a DeadLetterChannel. If its not we need to
    35              // try resending this message through the DeadLetterChannel.
    36              faultChannel.send(context, (OutMessage) context.getExchange().getFaultMessage());
    37          }
    38          catch (XFireException e)
    39          {
    40              logger.error("Could not send fault.", e);
    41          }
    42      }
    43  }