org.mule.api.routing
Interface ResponseRouter

All Superinterfaces:
Disposable, Initialisable, Router
All Known Implementing Classes:
AbstractResponseAggregator, AbstractResponseRouter, BankQuotesResponseAggregator, ResponseCorrelationAggregator, SimpleCollectionResponseAggregator, SingleResponseRouter

public interface ResponseRouter
extends Router

ResponseRouter is a router that handles response flow. Response Aggregators are used to collect responses that are usually sent to replyTo endpoints set on outbound routers. When an event is sent out via an outbound router, the response router will block the response flow on an Service until the Response Router resolves a reply or times out.


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
 MuleMessage getResponse(MuleMessage message)
          Called by the Mule framework once the outbound router has been processed on a service the Message passed in is the response message from the service (or outbount router if a response was returned).
 int getTimeout()
          Returns the timeout delay that the response router should wait for a response for a given event.
 boolean isFailOnTimeout()
          Should the router fail and throw an exception if a timeout occurs or should it return the events received so far.
 void process(MuleEvent event)
          This method is invoked when an event is received via an endpoint on this Response Router.
 void setFailOnTimeout(boolean fail)
          Should the router fail and throw an exception if a timeout occurs or should it return the events received so far.
 void setTimeout(int timeout)
          Sets the timeout delay that the response router should wait for a response for a given event.
 
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

process

void process(MuleEvent event)
             throws RoutingException
This method is invoked when an event is received via an endpoint on this Response Router. It is responsible for tieing up the event it receives with responses waiting to return back to the callee. This method will be called by a different thread to the getResponse method. The getResponse() method block the response execution until the process method signals that a match is found.

Parameters:
event -
Throws:
RoutingException

getResponse

MuleMessage getResponse(MuleMessage message)
                        throws RoutingException
Called by the Mule framework once the outbound router has been processed on a service the Message passed in is the response message from the service (or outbount router if a response was returned). This method is invoked to signal that the event flow for the service has completed and what ever message is returned from this method with be sent back as the response. This method will block until the correct response for the given Message has been received.

Parameters:
message - The processed message from the Service
Returns:
the response message sent back to the callee
Throws:
RoutingException
See Also:
MuleMessage, Service

setTimeout

void setTimeout(int timeout)
Sets the timeout delay that the response router should wait for a response for a given event. If the time expires and exception will be thrown by Mule.

Parameters:
timeout - the time in milliseconds to wait for a response event

getTimeout

int getTimeout()
Returns the timeout delay that the response router should wait for a response for a given event. If the time expires and exception will be thrown by Mule.

Returns:
the time in milliseconds to wait for a response event

setFailOnTimeout

void setFailOnTimeout(boolean fail)
Should the router fail and throw an exception if a timeout occurs or should it return the events received so far. //TODO This method is not implemented yet

Parameters:
fail -

isFailOnTimeout

boolean isFailOnTimeout()
Should the router fail and throw an exception if a timeout occurs or should it return the events received so far. //TODO This method is not implemented yet

Returns:


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