org.mule.routing.outbound
Class DefaultOutboundRouterCollection

java.lang.Object
  extended by org.mule.routing.outbound.DefaultOutboundRouterCollection
All Implemented Interfaces:
MuleContextAware, Disposable, Initialisable, MessageProcessor, MatchingRouter, OutboundRouterCollection, RouterStatisticsRecorder

public class DefaultOutboundRouterCollection
extends Object
implements OutboundRouterCollection

DefaultOutboundRouterCollection is a container of routers. An DefaultOutboundRouterCollection must have atleast one router. By default the first matching router is used to route an event though it is possible to match on all routers meaning that the message will get sent over all matching routers.


Field Summary
protected  Log logger
          logger used by this class
protected  boolean matchAll
           
protected  MuleContext muleContext
           
protected  List<MatchableMessageProcessor> routers
           
protected  RouterStatistics statistics
           
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
DefaultOutboundRouterCollection()
           
 
Method Summary
 void addRoute(MatchableMessageProcessor router)
           
protected  MuleEvent catchAll(MuleEvent event)
           
 void dispose()
          A lifecycle method where implementor should free up any resources.
 OutboundRouterCatchAllStrategy getCatchAllStrategy()
           
 RouterStatistics getRouterStatistics()
           
 List<MatchableMessageProcessor> getRoutes()
           
 boolean hasEndpoints()
          Determines if any targets have been set on this router.
 void initialise()
          Method used to perform any initialisation work.
 boolean isMatchAll()
           
 MuleEvent process(MuleEvent event)
          Invokes the MessageProcessor.
 void removeRoute(MatchableMessageProcessor router)
           
 void setCatchAllStrategy(OutboundRouterCatchAllStrategy catchAllStrategy)
           
 void setMatchAll(boolean matchAll)
           
 void setMessageProcessors(List<MatchableMessageProcessor> routers)
          Deprecated. 
 void setMuleContext(MuleContext context)
           
 void setRouterStatistics(RouterStatistics stat)
           
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

logger

protected final transient Log logger
logger used by this class


routers

protected List<MatchableMessageProcessor> routers

matchAll

protected boolean matchAll

statistics

protected RouterStatistics statistics

muleContext

protected MuleContext muleContext
Constructor Detail

DefaultOutboundRouterCollection

public DefaultOutboundRouterCollection()
Method Detail

process

public MuleEvent process(MuleEvent event)
                  throws MessagingException
Description copied from interface: MessageProcessor
Invokes the MessageProcessor.

Specified by:
process in interface MessageProcessor
Parameters:
event - MuleEvent to be processed
Returns:
optional response MuleEvent
Throws:
MessagingException

catchAll

protected MuleEvent catchAll(MuleEvent event)
                      throws RoutingException
Throws:
RoutingException

initialise

public void initialise()
                throws InitialisationException
Description copied from interface: Initialisable
Method used to perform any initialisation work. If a fatal error occurs during initialisation an InitialisationException should be thrown, causing the Mule instance to shutdown. If the error is recoverable, say by retrying to connect, a RecoverableException should be thrown. There is no guarantee that by throwing a Recoverable exception that the Mule instance will not shut down.

Specified by:
initialise in interface Initialisable
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

dispose

public void dispose()
Description copied from interface: Disposable
A lifecycle method where implementor should free up any resources. If an exception is thrown it should just be logged and processing should continue. This method should not throw Runtime exceptions.

Specified by:
dispose in interface Disposable

setMessageProcessors

@Deprecated
public void setMessageProcessors(List<MatchableMessageProcessor> routers)
Deprecated. 


addRoute

public void addRoute(MatchableMessageProcessor router)
Specified by:
addRoute in interface MatchingRouter

removeRoute

public void removeRoute(MatchableMessageProcessor router)
Specified by:
removeRoute in interface MatchingRouter

getRoutes

public List<MatchableMessageProcessor> getRoutes()
Specified by:
getRoutes in interface OutboundRouterCollection

getCatchAllStrategy

public OutboundRouterCatchAllStrategy getCatchAllStrategy()
Specified by:
getCatchAllStrategy in interface OutboundRouterCollection

setCatchAllStrategy

public void setCatchAllStrategy(OutboundRouterCatchAllStrategy catchAllStrategy)
Specified by:
setCatchAllStrategy in interface OutboundRouterCollection

isMatchAll

public boolean isMatchAll()
Specified by:
isMatchAll in interface OutboundRouterCollection

setMatchAll

public void setMatchAll(boolean matchAll)
Specified by:
setMatchAll in interface OutboundRouterCollection

getRouterStatistics

public RouterStatistics getRouterStatistics()
Specified by:
getRouterStatistics in interface OutboundRouterCollection

setRouterStatistics

public void setRouterStatistics(RouterStatistics stat)
Specified by:
setRouterStatistics in interface RouterStatisticsRecorder

setMuleContext

public void setMuleContext(MuleContext context)
Specified by:
setMuleContext in interface MuleContextAware

hasEndpoints

public boolean hasEndpoints()
Description copied from interface: OutboundRouterCollection
Determines if any targets have been set on this router.

Specified by:
hasEndpoints in interface OutboundRouterCollection

toString

public String toString()
Overrides:
toString in class Object


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