org.mule.routing.response
Class SingleResponseRouter

java.lang.Object
  extended byorg.mule.routing.response.AbstractResponseRouter
      extended byorg.mule.routing.response.AbstractResponseAggregator
          extended byorg.mule.routing.response.SingleResponseRouter
All Implemented Interfaces:
UMOResponseRouter, UMORouter

public class SingleResponseRouter
extends AbstractResponseAggregator

Handles single event responses from a replyTo address. If multiple responses will be received for a single invocation the ResponseCorrelationaggregator should be used.

Version:
$Revision: 3798 $
Author:
Ross Mason

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
SingleResponseRouter()
           
 
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.AbstractResponseAggregator
addEvent, createEventGroup, 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

SingleResponseRouter

public SingleResponseRouter()
Method Detail

shouldAggregate

protected boolean shouldAggregate(EventGroup events)
Determines if the event group is ready to be aggregated. if the group is ready to be aggregated (this is entirely up to the application. it could be determined by volume, last modified time or some oher criteria based on the last event received) Because this is a Single response router it will return true if the event group size is 1. It will raise a warning if the event Group size is greater than 1.

Specified by:
shouldAggregate in class AbstractResponseAggregator
Parameters:
events -
Returns:
true if the event group size is 1 or greater

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 Because this is a Single response router it returns the first event in the event group. It will raise a warning if the event Group size is greater than 1.

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


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