1 10 11 package org.mule.routing.inbound; 12 13 import org.mule.impl.MuleEvent; 14 import org.mule.impl.MuleMessage; 15 import org.mule.umo.MessagingException; 16 import org.mule.umo.UMOEvent; 17 import org.mule.umo.UMOException; 18 import org.mule.umo.UMOMessage; 19 import org.mule.umo.routing.RoutingException; 20 import org.mule.umo.routing.UMOOutboundMessageRouter; 21 22 27 public class ForwardingConsumer extends SelectiveConsumer 28 { 29 30 public UMOEvent[] process(UMOEvent event) throws MessagingException 31 { 32 if (super.process(event) != null) 33 { 34 UMOOutboundMessageRouter router = event.getComponent().getDescriptor().getOutboundRouter(); 35 36 event.setStopFurtherProcessing(true); 39 40 if (router == null) 41 { 42 logger.debug("Descriptor has no outbound router configured to forward to, continuing with normal processing"); 43 return new UMOEvent[]{event}; 44 } 45 else 46 { 47 try 48 { 49 UMOMessage message = new MuleMessage(event.getTransformedMessage(), event.getMessage()); 50 51 UMOMessage response = router.route(message, event.getSession(), event.isSynchronous()); 52 if (response != null) 55 { 56 return new UMOEvent[]{new MuleEvent(response, event)}; 57 } 58 else 59 { 60 return null; 61 } 62 63 } 64 catch (UMOException e) 65 { 66 throw new RoutingException(event.getMessage(), event.getEndpoint(), e); 67 } 68 } 69 } 70 return null; 71 } 72 } 73 | Popular Tags |