org.mule.routing
Class CollectionCorrelatorCallback

java.lang.Object
  extended by org.mule.routing.CollectionCorrelatorCallback
All Implemented Interfaces:
EventCorrelatorCallback
Direct Known Subclasses:
ResequenceCorrelatorCallback

public class CollectionCorrelatorCallback
extends Object
implements EventCorrelatorCallback

A Correlator that correlates messages based on Mule correlation settings


Field Summary
protected  Log logger
          logger used by this class
 
Constructor Summary
CollectionCorrelatorCallback()
           
 
Method Summary
 MuleMessage aggregateEvents(EventGroup events)
          This method is invoked if the shouldAggregate method is called and returns true.
 EventGroup createEventGroup(MuleEvent event, Object groupId)
          Creates a new EventGroup that will expect the number of events as returned by MessageAdapter.getCorrelationGroupSize().
 boolean shouldAggregateEvents(EventGroup events)
          Determines if the event group is ready to be aggregated.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

logger

protected final transient Log logger
logger used by this class

Constructor Detail

CollectionCorrelatorCallback

public CollectionCorrelatorCallback()
Method Detail

aggregateEvents

public MuleMessage aggregateEvents(EventGroup events)
                            throws AggregationException
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 interface EventCorrelatorCallback
Parameters:
events - the event group for this request
Returns:
an aggregated message
Throws:
AggregationException - if the aggregation fails. in this scenario the whole event group is removed and passed to the exception handler for this componenet

createEventGroup

public EventGroup createEventGroup(MuleEvent event,
                                   Object groupId)
Creates a new EventGroup that will expect the number of events as returned by MessageAdapter.getCorrelationGroupSize().

Specified by:
createEventGroup in interface EventCorrelatorCallback
Parameters:
event - the current event
groupId - The group id
Returns:
a new event group of a fixed size

shouldAggregateEvents

public boolean shouldAggregateEvents(EventGroup events)
Description copied from interface: EventCorrelatorCallback
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).

Specified by:
shouldAggregateEvents in interface EventCorrelatorCallback
Parameters:
events - The current event group received by the correlator
Returns:
true if the correlation size is not set or exactly the expected size of the event group.
See Also:
EventCorrelatorCallback.shouldAggregateEvents(org.mule.routing.inbound.EventGroup)


Copyright © 2003-2009 MuleSource, Inc.. All Rights Reserved.