Coverage Report - org.mule.service.ForwardingConsumer
 
Classes in this File Line Coverage Branch Coverage Complexity
ForwardingConsumer
0%
0/14
0%
0/6
0
 
 1  
 /*
 2  
  * $Id: ForwardingConsumer.java 19191 2010-08-25 21:05:23Z tcarlson $
 3  
  * --------------------------------------------------------------------------------------
 4  
  * Copyright (c) MuleSoft, Inc.  All rights reserved.  http://www.mulesoft.com
 5  
  *
 6  
  * The software in this package is published under the terms of the CPAL v1.0
 7  
  * license, a copy of which has been included with this distribution in the
 8  
  * LICENSE.txt file.
 9  
  */
 10  
 
 11  
 package org.mule.service;
 12  
 
 13  
 import org.mule.api.MessagingException;
 14  
 import org.mule.api.MuleEvent;
 15  
 import org.mule.api.MuleException;
 16  
 import org.mule.api.processor.MessageProcessor;
 17  
 import org.mule.api.routing.RoutingException;
 18  
 import org.mule.api.service.Service;
 19  
 import org.mule.routing.MessageFilter;
 20  
 
 21  
 /**
 22  
  * <code>ForwardingConsumer</code> is used to forward an incoming event over another transport without
 23  
  * invoking a service. This can be used to implement a bridge accross different transports.
 24  
  * @deprecated
 25  
  */
 26  
 @Deprecated
 27  0
 public class ForwardingConsumer extends MessageFilter
 28  
 {
 29  
     @Override
 30  
     public MuleEvent processNext(MuleEvent event) throws MessagingException
 31  
     {
 32  0
         if (!(event.getFlowConstruct() instanceof Service))
 33  
         {
 34  0
             throw new UnsupportedOperationException("ForwardingConsumer is only supported with Service");
 35  
         }
 36  
 
 37  0
         MessageProcessor processor = ((Service) event.getFlowConstruct()).getOutboundMessageProcessor();
 38  
 
 39  
         // Set the stopFurtherProcessing flag to true to inform the
 40  
         // DefaultInboundRouterCollection not to route these events to the service
 41  0
         event.setStopFurtherProcessing(true);
 42  
 
 43  0
         if (processor == null)
 44  
         {
 45  0
             logger.debug("Descriptor has no outbound router configured to forward to, continuing with normal processing");
 46  0
             return event;
 47  
         }
 48  
         else
 49  
         {
 50  
             try
 51  
             {
 52  0
                 MuleEvent resultEvent = processor.process(event);
 53  0
                 if (resultEvent != null)
 54  
                 {
 55  0
                     return resultEvent;
 56  
                 }
 57  
                 else
 58  
                 {
 59  0
                     return null;
 60  
                 }
 61  
             }
 62  0
             catch (MuleException e)
 63  
             {
 64  0
                 throw new RoutingException(event, this, e);
 65  
             }
 66  
         }
 67  
     }
 68  
 }