org.mule.routing.inbound
Class AbstractEventAggregator

java.lang.Object
  extended byorg.mule.routing.inbound.SelectiveConsumer
      extended byorg.mule.routing.inbound.AbstractEventAggregator
All Implemented Interfaces:
UMOInboundRouter, UMORouter
Direct Known Subclasses:
CorrelationAggregator

public abstract class AbstractEventAggregator
extends SelectiveConsumer

AbstractEventAggregator will aggregate a set of messages into a single message

Version:
$Revision: 1.1.1.1 $
Author:
Ross Mason

Field Summary
protected  java.util.Map eventGroups
           
protected static java.lang.String NO_CORRELATION_ID
           
 
Fields inherited from class org.mule.routing.inbound.SelectiveConsumer
logger
 
Constructor Summary
AbstractEventAggregator()
           
 
Method Summary
protected  EventGroup addEvent(UMOEvent event)
          Adds the event to an event group.
protected abstract  UMOMessage aggregateEvents(EventGroup events)
          This method is invoked if the shouldAggregate method is called and returns true.
 UMOEvent[] process(UMOEvent event)
           
protected  void removeGroup(java.lang.String id)
           
protected abstract  boolean shouldAggregate(EventGroup events)
          Determines if the event group is ready to be aggregated.
 
Methods inherited from class org.mule.routing.inbound.SelectiveConsumer
getFilter, getRouterStatistics, isMatch, isTransformFirst, setFilter, setRouterStatistics, setTransformFirst
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

NO_CORRELATION_ID

protected static final java.lang.String NO_CORRELATION_ID
See Also:
Constant Field Values

eventGroups

protected java.util.Map eventGroups
Constructor Detail

AbstractEventAggregator

public AbstractEventAggregator()
Method Detail

process

public UMOEvent[] process(UMOEvent event)
                   throws RoutingException
Specified by:
process in interface UMOInboundRouter
Overrides:
process in class SelectiveConsumer
Throws:
RoutingException

addEvent

protected EventGroup addEvent(UMOEvent event)
Adds the event to an event group. Groups are defined by the correlationId on the message. If no correlationId is set a default group is created for all events without a correlationId. If there is no group for the current correlationId one will be created and added to the router.

Parameters:
event -
Returns:

removeGroup

protected void removeGroup(java.lang.String id)

shouldAggregate

protected abstract 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)

Parameters:
events -
Returns:

aggregateEvents

protected abstract 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

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-2005 SymphonySoft Limited. All Rights Reserved.