org.mule.routing.response
Class AbstractResponseAggregator
java.lang.Object
org.mule.routing.AbstractRouter
org.mule.routing.response.AbstractResponseRouter
org.mule.routing.response.AbstractResponseAggregator
- All Implemented Interfaces:
- MuleContextAware, Disposable, Initialisable, ResponseRouter, Router
- Direct Known Subclasses:
- ResponseCorrelationAggregator, SingleResponseRouter
public abstract class AbstractResponseAggregator
- extends AbstractResponseRouter
AbstractResponseAggregator
provides a base class for implementing
response aggregator routers. This provides a thread-safe implemenetation and
allows developers to customise how and when events are grouped and collated.
Response Agrregators 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.
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
AbstractResponseAggregator
public AbstractResponseAggregator()
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
- Overrides:
initialise
in class AbstractRouter
- Throws:
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdown
RecoverableException
- if an error occurs that can be recovered from
getEventCorrelator
protected EventCorrelator getEventCorrelator()
process
public void process(MuleEvent event)
throws RoutingException
- Description copied from interface:
ResponseRouter
- 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.
- Throws:
RoutingException
getResponse
public MuleMessage getResponse(MuleMessage message)
throws RoutingException
- This method is called by the responding callee thread and should return the
aggregated response message
- Parameters:
message
-
- Returns:
-
- Throws:
RoutingException
- See Also:
MuleMessage
,
Service
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
- 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
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.
- 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.
- Parameters:
timeout
- the time in milliseconds to wait for a response event
getCorrelatorCallback
protected abstract EventCorrelatorCallback getCorrelatorCallback()
aggregateEvents
protected MuleMessage aggregateEvents(EventGroup events)
throws RoutingException
- Throws:
RoutingException
Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.