public abstract class AbstractOutboundRouter extends AbstractMessageProcessorOwner implements OutboundRouter
AbstractOutboundRouter is a base router class that tracks statistics about message processing
through the router.| Modifier and Type | Field and Description |
|---|---|
protected CorrelationMode |
enableCorrelation
Determines if Mule stamps outgoing message with a correlation ID or not.
|
protected AtomicBoolean |
initialised |
protected org.apache.commons.logging.Log |
logger
logger used by this class
|
protected String |
replyTo |
protected RouterResultsHandler |
resultsHandler |
protected List<MessageProcessor> |
routes |
protected AtomicBoolean |
started |
protected TransactionConfig |
transactionConfig |
flowConstruct, messagingExceptionHandler, muleContextPHASE_NAMEPHASE_NAMEPHASE_NAMEPHASE_NAMEPROPERTY_NAME| Constructor and Description |
|---|
AbstractOutboundRouter() |
| Modifier and Type | Method and Description |
|---|---|
void |
addRoute(MessageProcessor route)
Adds a new message processor to the list of routes
|
protected MuleMessage |
cloneMessage(MuleEvent event,
MuleMessage message)
Creates a fresh copy of a
MuleMessage ensuring that the payload can be cloned (i.e. |
protected MuleMessage |
cloneMessage(MuleMessage message)
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
|
void |
dispose()
A lifecycle method where implementor should free up any resources.
|
CorrelationMode |
getEnableCorrelation() |
MuleContext |
getMuleContext() |
protected List<MessageProcessor> |
getOwnedMessageProcessors() |
String |
getReplyTo() |
RouterResultsHandler |
getResultsHandler() |
MessageProcessor |
getRoute(String name) |
RouterStatistics |
getRouterStatistics() |
List<MessageProcessor> |
getRoutes()
Gets a list of MessageProcessor instances associated with this router
|
TransactionConfig |
getTransactionConfig() |
void |
initialise()
Method used to perform any initialisation work.
|
boolean |
isDynamicRoutes()
Determines whether this router supports dynamic route.
|
MuleEvent |
process(MuleEvent event)
Invokes the MessageProcessor.
|
protected void |
propagateMagicProperties(MuleMessage in,
MuleMessage out)
Propagates a number of internal system properties to handle correlation, session, etc.
|
void |
removeRoute(MessageProcessor route)
Removes a message processor from the list of routes
|
protected abstract MuleEvent |
route(MuleEvent event) |
protected MuleEvent |
sendRequest(MuleEvent routedEvent,
MuleMessage message,
MessageProcessor route,
boolean awaitResponse) |
protected MuleEvent |
sendRequestEvent(MuleEvent routedEvent,
MuleMessage message,
MessageProcessor route,
boolean awaitResponse)
Send message event to destination.
|
void |
setEnableCorrelation(CorrelationMode enableCorrelation) |
void |
setEnableCorrelationAsString(String enableCorrelation) |
void |
setMessageProcessors(List<MessageProcessor> routes)
Deprecated.
|
protected void |
setMessageProperties(FlowConstruct service,
MuleMessage message,
MessageProcessor route) |
void |
setReplyTo(String replyTo)
Sets the replyTo route for any outgoing messages.
|
void |
setResultsHandler(RouterResultsHandler resultsHandler) |
void |
setRouterStatistics(RouterStatistics stats) |
void |
setRoutes(List<MessageProcessor> routes) |
void |
setTransactionConfig(TransactionConfig transactionConfig) |
void |
start() |
void |
stop() |
addMessageProcessorPathElements, getAnnotation, getAnnotations, getOwnedObjects, setAnnotationsgetFlowConstruct, getMessagingExceptionHandler, setFlowConstruct, setMessagingExceptionHandler, setMuleContextclone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitsetMuleContextsetFlowConstructprotected transient org.apache.commons.logging.Log logger
protected List<MessageProcessor> routes
protected String replyTo
protected CorrelationMode enableCorrelation
protected TransactionConfig transactionConfig
protected RouterResultsHandler resultsHandler
protected AtomicBoolean initialised
protected AtomicBoolean started
public MuleEvent process(MuleEvent event) throws MuleException
MessageProcessorprocess in interface MessageProcessorevent - MuleEvent to be processedMuleExceptionprotected abstract MuleEvent route(MuleEvent event) throws MessagingException
MessagingExceptionprotected final MuleEvent sendRequest(MuleEvent routedEvent, MuleMessage message, MessageProcessor route, boolean awaitResponse) throws MuleException
MuleExceptionprotected void setMessageProperties(FlowConstruct service, MuleMessage message, MessageProcessor route)
public List<MessageProcessor> getRoutes()
OutboundRoutergetRoutes in interface OutboundRouter@Deprecated public void setMessageProcessors(List<MessageProcessor> routes) throws MuleException
MuleExceptionpublic void setRoutes(List<MessageProcessor> routes) throws MuleException
MuleExceptionpublic void addRoute(MessageProcessor route) throws MuleException
MessageRouteraddRoute in interface MessageRouterroute - new destination message processorMuleExceptionpublic void removeRoute(MessageProcessor route) throws MuleException
MessageRouterremoveRoute in interface MessageRouterroute - destination message processor to removeMuleExceptionpublic String getReplyTo()
public void setReplyTo(String replyTo)
OutboundRoutersetReplyTo in interface OutboundRouterreplyTo - route string to usepublic CorrelationMode getEnableCorrelation()
public void setEnableCorrelation(CorrelationMode enableCorrelation)
public void setEnableCorrelationAsString(String enableCorrelation)
public TransactionConfig getTransactionConfig()
public void setTransactionConfig(TransactionConfig transactionConfig)
setTransactionConfig in interface OutboundRouterpublic boolean isDynamicRoutes()
OutboundRouterisDynamicRoutes in interface OutboundRouterpublic MessageProcessor getRoute(String name)
name - the route identifierpublic RouterResultsHandler getResultsHandler()
public void setResultsHandler(RouterResultsHandler resultsHandler)
protected MuleEvent sendRequestEvent(MuleEvent routedEvent, MuleMessage message, MessageProcessor route, boolean awaitResponse) throws MuleException
MuleExceptionprotected MuleEvent createEventToRoute(MuleEvent routedEvent, MuleMessage message, MessageProcessor route)
protected MuleMessage cloneMessage(MuleMessage message)
protected MuleMessage cloneMessage(MuleEvent event, MuleMessage message) throws MessagingException
MuleMessage ensuring that the payload can be cloned (i.e. is not consumable).event - The MuleEvent to clone the message from.MuleMessage.MessagingException - If the message can't be cloned because it carries a consumable payload.protected void propagateMagicProperties(MuleMessage in, MuleMessage out)
public void initialise()
throws InitialisationException
InitialisableInitialisationException 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.initialise in interface Initialisableinitialise in class AbstractMuleObjectOwner<MessageProcessor>InitialisationException - if a fatal error occurs causing the Mule instance to shutdownRecoverableException - if an error occurs that can be recovered frompublic void dispose()
Disposabledispose in interface Disposabledispose in class AbstractMuleObjectOwner<MessageProcessor>public void start()
throws MuleException
start in interface Startablestart in class AbstractMuleObjectOwner<MessageProcessor>MuleExceptionpublic void stop()
throws MuleException
stop in interface Stoppablestop in class AbstractMuleObjectOwner<MessageProcessor>MuleExceptionpublic MuleContext getMuleContext()
getMuleContext in class AbstractMuleObjectOwner<MessageProcessor>public void setRouterStatistics(RouterStatistics stats)
setRouterStatistics in interface RouterStatisticsRecorderpublic RouterStatistics getRouterStatistics()
protected List<MessageProcessor> getOwnedMessageProcessors()
getOwnedMessageProcessors in class AbstractMessageProcessorOwnerCopyright © 2003–2015 MuleSoft, Inc.. All rights reserved.