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.logger, messageInfoMapping
muleContext
PHASE_NAME
PHASE_NAME
Constructor and Description |
---|
AbstractResponseAggregator() |
Modifier and Type | Method and Description |
---|---|
protected MuleMessage |
aggregateEvents(EventGroup events) |
protected abstract EventCorrelatorCallback |
getCorrelatorCallback() |
protected EventCorrelator |
getEventCorrelator() |
MuleMessage |
getResponse(MuleMessage message)
This method is called by the responding callee thread and should return the
aggregated response message
|
int |
getTimeout()
Returns the timeout delay that the response router should wait for a response
for a given event.
|
void |
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 |
process(MuleEvent event)
This method is invoked when an event is received via an endpoint on this
Response Router.
|
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 |
setTimeout(int timeout)
Sets the timeout delay that the response router should wait for a response for
a given event.
|
getCallResponseAggregateIdentifier, getMessageInfoMapping, getReplyAggregateIdentifier, setMessageInfoMapping
dispose, getMuleContext, getRouterStatistics, setMuleContext, setRouterStatistics
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
getRouterStatistics, setRouterStatistics
dispose
public void initialise() throws InitialisationException
Initialisable
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.initialise
in interface Initialisable
initialise
in class AbstractRouter
InitialisationException
- if a fatal error occurs causing the Mule instance to shutdownRecoverableException
- if an error occurs that can be recovered fromprotected EventCorrelator getEventCorrelator()
public void process(MuleEvent event) throws RoutingException
ResponseRouter
RoutingException
public MuleMessage getResponse(MuleMessage message) throws RoutingException
message
- RoutingException
MuleMessage
,
Service
public boolean isFailOnTimeout()
ResponseRouter
public void setFailOnTimeout(boolean failOnTimeout)
ResponseRouter
public int getTimeout()
ResponseRouter
public void setTimeout(int timeout)
ResponseRouter
timeout
- the time in milliseconds to wait for a response eventprotected abstract EventCorrelatorCallback getCorrelatorCallback()
protected MuleMessage aggregateEvents(EventGroup events) throws RoutingException
RoutingException
AbstractEventAggregator#aggregateEvents(EventGroup)
Copyright © 2003–2013 MuleSource, Inc.. All rights reserved.