org.mule.routing.correlation
Class CollectionCorrelatorCallback

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

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
protected  MuleContext muleContext
           
 
Constructor Summary
CollectionCorrelatorCallback(MuleContext muleContext, boolean persistantStores, String storePrefix)
           
 
Method Summary
 MuleEvent 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 MuleMessage.getCorrelationGroupSize().
protected  MuleSession getMergedSession(MuleEvent[] events)
           
 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


muleContext

protected MuleContext muleContext
Constructor Detail

CollectionCorrelatorCallback

public CollectionCorrelatorCallback(MuleContext muleContext,
                                    boolean persistantStores,
                                    String storePrefix)
Method Detail

aggregateEvents

public MuleEvent 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

getMergedSession

protected MuleSession getMergedSession(MuleEvent[] events)

createEventGroup

public EventGroup createEventGroup(MuleEvent event,
                                   Object groupId)
Creates a new EventGroup that will expect the number of events as returned by MuleMessage.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.EventGroup)


Copyright © 2003-2012 MuleSoft, Inc.. All Rights Reserved.