org.mule.routing.response
Class AbstractResponseRouter

java.lang.Object
  extended by org.mule.routing.AbstractRouter
      extended by org.mule.routing.response.AbstractResponseRouter
All Implemented Interfaces:
MuleContextAware, Disposable, Initialisable, ResponseRouter, Router
Direct Known Subclasses:
AbstractResponseAggregator

public abstract class AbstractResponseRouter
extends AbstractRouter
implements ResponseRouter

AbstractResponseRouter is a base class for all Response Routers


Field Summary
protected  Log logger
           
protected  ExpressionEvaluator propertyExtractor
           
 
Fields inherited from class org.mule.routing.AbstractRouter
muleContext
 
Fields inherited from interface org.mule.api.lifecycle.Initialisable
PHASE_NAME
 
Fields inherited from interface org.mule.api.lifecycle.Disposable
PHASE_NAME
 
Constructor Summary
AbstractResponseRouter()
           
 
Method Summary
protected  Object getCallResponseAggregateIdentifier(MuleMessage message)
          Extracts a Group identifier from the current event.
 ExpressionEvaluator getPropertyExtractor()
           
protected  Object getReplyAggregateIdentifier(MuleMessage message)
          Extracts a 'Correlation Id' from a reply message.
 int getTimeout()
          Returns the timeout delay that the response router should wait for a response for a given event.
 LifecycleTransitionResult initialise()
          Method used to perform any initialisation work.
 boolean isFailOnTimeout()
          Should the router fail and throw an exception if a timeout occurs or should it return the events received so far.
 void setFailOnTimeout(boolean failOnTimeout)
          Should the router fail and throw an exception if a timeout occurs or should it return the events received so far.
 void setPropertyExtractor(ExpressionEvaluator propertyExtractor)
           
 void setPropertyExtractorAsString(String className)
          A digester callback to configure a custom correlation extractor.
 void setTimeout(int timeout)
          Sets the timeout delay that the response router should wait for a response for a given event.
 
Methods inherited from class org.mule.routing.AbstractRouter
dispose, getMuleContext, getRouterStatistics, setMuleContext, setRouterStatistics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mule.api.routing.ResponseRouter
getResponse, process
 
Methods inherited from interface org.mule.api.routing.Router
getRouterStatistics, setRouterStatistics
 
Methods inherited from interface org.mule.api.lifecycle.Disposable
dispose
 

Field Detail

logger

protected final Log logger

propertyExtractor

protected ExpressionEvaluator propertyExtractor
Constructor Detail

AbstractResponseRouter

public AbstractResponseRouter()
Method Detail

initialise

public LifecycleTransitionResult 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
Overrides:
initialise in class AbstractRouter
Returns:
Status of transition
Throws:
InitialisationException - if a fatal error occurs causing the Mule instance to shutdown
RecoverableException - if an error occurs that can be recovered from

getPropertyExtractor

public ExpressionEvaluator getPropertyExtractor()

setPropertyExtractor

public void setPropertyExtractor(ExpressionEvaluator propertyExtractor)

setPropertyExtractorAsString

public void setPropertyExtractorAsString(String className)
A digester callback to configure a custom correlation extractor.

Parameters:
className - correlation extractor fully qualified class name

getTimeout

public int getTimeout()
Description copied from interface: ResponseRouter
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.

Specified by:
getTimeout in interface ResponseRouter
Returns:
the time in milliseconds to wait for a response event

setTimeout

public void setTimeout(int timeout)
Description copied from interface: ResponseRouter
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.

Specified by:
setTimeout in interface ResponseRouter
Parameters:
timeout - the time in milliseconds to wait for a response event

getReplyAggregateIdentifier

protected Object getReplyAggregateIdentifier(MuleMessage message)
Extracts a 'Correlation Id' from a reply message. The correlation Id does not have to be the Message Correlation Id. It can be extracted from the message payload if desired.

Parameters:
message - a received reply message
Returns:
the correlation Id for this message

getCallResponseAggregateIdentifier

protected Object getCallResponseAggregateIdentifier(MuleMessage message)
Extracts a Group identifier from the current event. When an event is received with a group identifier not registered with this router, a new group is created. The id returned here can be a correlationId or some custom aggregation Id. This implementation uses the Unique Message Id of the MuleMessage being returned a

Parameters:
message - A response messages received on the response router endpoint
Returns:
an aggregation Id for this event

isFailOnTimeout

public boolean isFailOnTimeout()
Description copied from interface: ResponseRouter
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

Specified by:
isFailOnTimeout in interface ResponseRouter
Returns:

setFailOnTimeout

public void setFailOnTimeout(boolean failOnTimeout)
Description copied from interface: ResponseRouter
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

Specified by:
setFailOnTimeout in interface ResponseRouter


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