org.mule.api.routing
Interface OutboundRouter

All Superinterfaces:
Disposable, Initialisable, Router
All Known Implementing Classes:
AbstractMessageSplitter, AbstractOutboundRouter, AbstractRecipientList, AbstractRoundRobinMessageSplitter, ChainingRouter, EndpointSelector, ExceptionBasedRouter, ExpressionMessageSplitter, ExpressionRecipientList, FilterBasedXmlMessageSplitter, FilteringOutboundRouter, ListMessageSplitter, MessageChunkingRouter, MulticastingRouter, OutboundPassThroughRouter, StaticRecipientList, SxcFilteringOutboundRouter, TemplateEndpointRouter, TransformerRouter, XmlMessageSplitter

public interface OutboundRouter
extends Router

OutboundRouter is used to control outbound routing behaviour for an event. One or more Outbound routers can be associated with an OutboundRouterCollection and will be selected based on the filters set on the individual Outbound Router.

See Also:
OutboundRouterCollection

Field Summary
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Method Summary
 void addEndpoint(OutboundEndpoint endpoint)
          Adds an endpoint to this router
 OutboundEndpoint getEndpoint(String name)
           
 List getEndpoints()
          Gets a list of Endpoint instances associated with this router
 String getReplyTo()
          Gets the replyTo endpoint for any outgoing messages.
 TransactionConfig getTransactionConfig()
           
 boolean isDynamicEndpoints()
          Determines whether this router supports dynamic endpoint.
 boolean isMatch(MuleMessage message)
          Determines if the event should be processed by this router.
 boolean isRequiresNewMessage()
          Determines is this router requires a new message copy.
 boolean removeEndpoint(OutboundEndpoint endpoint)
          Removes a specific endpoint from the router
 MuleMessage route(MuleMessage message, MuleSession session)
          This method is responsible for routing the Message via the MuleSession.
 void setEndpoints(List endpoints)
          Sets a list of Endpoint instances associated with this router
 void setReplyTo(String replyTo)
          Sets the replyTo endpoint for any outgoing messages.
 void setTransactionConfig(TransactionConfig transactionConfig)
           
 
Methods inherited from interface org.mule.api.routing.Router
getRouterStatistics, setRouterStatistics
 
Methods inherited from interface org.mule.api.lifecycle.Initialisable
initialise
 
Methods inherited from interface org.mule.api.lifecycle.Disposable
dispose
 

Method Detail

setEndpoints

void setEndpoints(List endpoints)
Sets a list of Endpoint instances associated with this router

Parameters:
endpoints - a list of Endpoint instances

getEndpoints

List getEndpoints()
Gets a list of Endpoint instances associated with this router

Returns:
a list of Endpoint instances

addEndpoint

void addEndpoint(OutboundEndpoint endpoint)
Adds an endpoint to this router

Parameters:
endpoint - the endpoint to add to the router

removeEndpoint

boolean removeEndpoint(OutboundEndpoint endpoint)
Removes a specific endpoint from the router

Parameters:
endpoint - the endpoint to remove
Returns:
true if the endpoint was removed

route

MuleMessage route(MuleMessage message,
                  MuleSession session)
                  throws MessagingException
This method is responsible for routing the Message via the MuleSession. The logic for this method will change for each type of router depending on expected behaviour. For example, a MulticastingRouter might just iterate through the list of assoaciated endpoints sending the message. Another type of router such as the ExceptionBasedRouter will hit the first endpoint, if it fails try the second, and so on. Most router implementations will extends the FilteringOutboundRouter which implements all the common logic need for a router.

Parameters:
message - the message to send via one or more endpoints on this router
session - the session used to actually send the event
Returns:
a result message if any from the invocation. If the synchronous flag is false a null result will always be returned.
Throws:
MessagingException - if any errors occur during the sending of messages
Since:
2.1 the synchronous argument has been removed. Instead use the synchronous attribute of the endpoint you are dispatching to.
See Also:
FilteringOutboundRouter, ExceptionBasedRouter, MulticastingRouter

isMatch

boolean isMatch(MuleMessage message)
                throws MessagingException
Determines if the event should be processed by this router. Routers can be selectively invoked by configuring a filter on them. Usually the filter is applied to the message when calling this method. All core Mule outbound routers extend the FilteringOutboundRouter router that handles this method automatically.

Parameters:
message - the current message to evaluate
Returns:
true if the event should be processed by this router
Throws:
MessagingException - if the event cannot be evaluated
See Also:
SelectiveConsumer

getTransactionConfig

TransactionConfig getTransactionConfig()

setTransactionConfig

void setTransactionConfig(TransactionConfig transactionConfig)

getReplyTo

String getReplyTo()
Gets the replyTo endpoint for any outgoing messages. This will then be used by other Mule routers to send replies back for this message. If the underlying protocol supports replyTo messages, such as Jms, a Jms Destination will be attached to the outbound message

Returns:
the replyTo endpoint or null if one has not been set.

setReplyTo

void setReplyTo(String replyTo)
Sets the replyTo endpoint for any outgoing messages. This will then be used by other Mule routers to send replies back for this message. If the underlying protocol supports replyTo messages, such as Jms, a Jms Destination will be attached to the outbound message

Parameters:
replyTo - endpoint string to use

isDynamicEndpoints

boolean isDynamicEndpoints()
Determines whether this router supports dynamic endpoint. i.e. endpoints that are not configured at design time. Endpoints might be pulled from the message or payload.

Returns:

getEndpoint

OutboundEndpoint getEndpoint(String name)
Parameters:
name - the Endpoint identifier
Returns:
the Endpoint or null if the endpointUri is not registered

isRequiresNewMessage

boolean isRequiresNewMessage()
Determines is this router requires a new message copy.

Returns:


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.