org.mule.samples.loanbroker.routers
Class BankQuotesResponseAggregator

java.lang.Object
  extended byorg.mule.routing.response.AbstractResponseRouter
      extended byorg.mule.routing.response.AbstractResponseAggregator
          extended byorg.mule.routing.response.ResponseCorrelationAggregator
              extended byorg.mule.samples.loanbroker.routers.BankQuotesResponseAggregator
All Implemented Interfaces:
UMOResponseRouter, UMORouter

public class BankQuotesResponseAggregator
extends ResponseCorrelationAggregator

BankQuotesAggregator receives a number of quotes and selects the lowest.


Field Summary
 
Fields inherited from class org.mule.routing.response.AbstractResponseAggregator
eventGroups, responseEvents
 
Fields inherited from class org.mule.routing.response.AbstractResponseRouter
correlationExtractor, logger
 
Constructor Summary
BankQuotesResponseAggregator()
           
 
Method Summary
protected  UMOMessage aggregateEvents(EventGroup events)
          This method is invoked if the shouldAggregate method is called and returns true.
protected  boolean shouldAggregate(EventGroup events)
          Determines if the event group is ready to be aggregated.
 
Methods inherited from class org.mule.routing.response.ResponseCorrelationAggregator
createEventGroup
 
Methods inherited from class org.mule.routing.response.AbstractResponseAggregator
addEvent, getResponse, process, removeEventGroup
 
Methods inherited from class org.mule.routing.response.AbstractResponseRouter
getCallResponseAggregateIdentifier, getCorrelationExtractor, getReplyAggregateIdentifier, getRouterStatistics, getTimeout, setCorrelationExtractor, setPropertyExtractorAsString, setRouterStatistics, setTimeout
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

BankQuotesResponseAggregator

public BankQuotesResponseAggregator()
Method Detail

aggregateEvents

protected UMOMessage aggregateEvents(EventGroup events)
                              throws RoutingException
This method is invoked if the shouldAggregate method is called and returns true. Once this method returns an aggregated message the event group is removed from the router

Specified by:
aggregateEvents in class AbstractResponseAggregator
Parameters:
events - the event group for this request
Returns:
an aggregated message
Throws:
RoutingException - if the aggregation fails. in this scenario the whole event group is removed and passed to the exception handler for this componenet

shouldAggregate

protected boolean shouldAggregate(EventGroup events)
Determines if the event group is ready to be aggregated. This is entirely up to the application. It could be determined by volume, last modified time or some other criteria based on the last event received.

Overrides:
shouldAggregate in class ResponseCorrelationAggregator
Parameters:
events -
Returns:


Copyright © 2003-2006 MuleSource Inc.. All Rights Reserved.