org.mule.routing
Class AbstractRoutingStrategy

java.lang.Object
  extended by org.mule.routing.AbstractRoutingStrategy
All Implemented Interfaces:
RoutingStrategy
Direct Known Subclasses:
FirstSuccessfulRoutingStrategy, MulticastingRoutingStrategy, RoundRobinRoutingStrategy

public abstract class AbstractRoutingStrategy
extends Object
implements RoutingStrategy

Abstract routing strategy with utility methods to be reused by routing strategies


Field Summary
protected static Log logger
          logger used by this class
protected static List<String> magicProperties
          These properties are automatically propagated by Mule from inbound to outbound
 
Constructor Summary
AbstractRoutingStrategy(MuleContext muleContext)
           
 
Method Summary
protected static void assertNonConsumableMessage(MuleEvent event, MuleMessage message)
          Asserts that the MuleMessage in the MuleEvent doesn't carry a consumable payload.
static MuleMessage cloneMessage(MuleEvent event, MuleMessage message, MuleContext muleContext)
           
static MuleMessage cloneMessage(MuleMessage message, MuleContext muleContext)
          Create a fresh copy of a message.
protected  MuleEvent createEventToRoute(MuleEvent routedEvent, MuleMessage message, MessageProcessor route)
          Create a new event to be routed to the target MP
protected  MuleContext getMuleContext()
           
static void propagateMagicProperties(MuleMessage in, MuleMessage out)
          Propagates a number of internal system properties to handle correlation, session, etc.
protected  MuleEvent sendRequest(MuleEvent routedEvent, MuleMessage message, MessageProcessor route, boolean awaitResponse)
          Send message event to destination.
static void validateMessageIsNotConsumable(MuleEvent event, MuleMessage message)
          Validates that the payload is not consumable so it can be copied.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mule.routing.RoutingStrategy
route
 

Field Detail

magicProperties

protected static List<String> magicProperties
These properties are automatically propagated by Mule from inbound to outbound


logger

protected static transient Log logger
logger used by this class

Constructor Detail

AbstractRoutingStrategy

public AbstractRoutingStrategy(MuleContext muleContext)
Method Detail

sendRequest

protected final MuleEvent sendRequest(MuleEvent routedEvent,
                                      MuleMessage message,
                                      MessageProcessor route,
                                      boolean awaitResponse)
                               throws MuleException
Send message event to destination. Creates a new event that will be used to process the route.

Parameters:
routedEvent - event to route
message - message to route
route - message processor to be executed
awaitResponse - if the
Returns:
Throws:
MuleException

createEventToRoute

protected MuleEvent createEventToRoute(MuleEvent routedEvent,
                                       MuleMessage message,
                                       MessageProcessor route)
Create a new event to be routed to the target MP


cloneMessage

public static MuleMessage cloneMessage(MuleMessage message,
                                       MuleContext muleContext)
Create a fresh copy of a message.


getMuleContext

protected MuleContext getMuleContext()

propagateMagicProperties

public static void propagateMagicProperties(MuleMessage in,
                                            MuleMessage out)
Propagates a number of internal system properties to handle correlation, session, etc. Note that in and out params can be the same message object when not dealing with replies.

See Also:
This method is mostly used by routers that dispatch the same message to several routes

validateMessageIsNotConsumable

public static void validateMessageIsNotConsumable(MuleEvent event,
                                                  MuleMessage message)
                                           throws MessagingException
Validates that the payload is not consumable so it can be copied. If validation fails then throws a MessagingException

Parameters:
event -
message -
Throws:
MessagingException

cloneMessage

public static MuleMessage cloneMessage(MuleEvent event,
                                       MuleMessage message,
                                       MuleContext muleContext)
                                throws MessagingException
Throws:
MessagingException

assertNonConsumableMessage

protected static void assertNonConsumableMessage(MuleEvent event,
                                                 MuleMessage message)
                                          throws MessagingException
Asserts that the MuleMessage in the MuleEvent doesn't carry a consumable payload. This method is useful for routers which need to clone the message before dispatching the message to multiple routes.

Parameters:
event - The MuleEvent.
event - The MuleMessage whose payload is to be verified.
Throws:
MessagingException - If the payload of the message is consumable.


Copyright © 2003-2014 MuleSoft, Inc.. All Rights Reserved.