org.mule.routing.inbound
Class AbstractEventResequencer

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

public abstract class AbstractEventResequencer
extends SelectiveConsumer

AbstractEventResequencer is used to receive a set of events, resequence them and forward them on to their destination


Field Summary
protected static String NO_CORRELATION_ID
           
 
Fields inherited from class org.mule.routing.inbound.SelectiveConsumer
logger
 
Constructor Summary
AbstractEventResequencer()
           
 
Method Summary
protected  EventGroup addEventGroup(EventGroup group)
           
protected  EventGroup createEventGroup(UMOEvent event, Object groupId)
           
 Comparator getComparator()
           
protected  EventGroup getEventGroup(Object groupId)
           
protected  Object getEventGroupIdForEvent(UMOEvent event)
           
 UMOEvent[] process(UMOEvent event)
          A received UMOEvent is passed to this method for processing.
protected  void removeEventGroup(EventGroup group)
           
protected  UMOEvent[] resequenceEvents(EventGroup events)
          Reorder collected events according to the configured Comparator.
 void setComparator(Comparator eventComparator)
           
protected abstract  boolean shouldResequenceEvents(EventGroup events)
          Determines whether the events in the passed EventGroup are ready to be reordered.
 
Methods inherited from class org.mule.routing.inbound.SelectiveConsumer
getFilter, isMatch, isTransformFirst, setFilter, setTransformFirst
 
Methods inherited from class org.mule.routing.AbstractRouter
getRouterStatistics, setRouterStatistics
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface org.mule.umo.routing.UMORouter
getRouterStatistics, setRouterStatistics
 

Field Detail

NO_CORRELATION_ID

protected static final String NO_CORRELATION_ID
See Also:
Constant Field Values
Constructor Detail

AbstractEventResequencer

public AbstractEventResequencer()
Method Detail

getComparator

public Comparator getComparator()

setComparator

public void setComparator(Comparator eventComparator)

process

public UMOEvent[] process(UMOEvent event)
                   throws MessagingException
Description copied from interface: UMOInboundRouter
A received UMOEvent is passed to this method for processing. The router can control processing by either 1. passing back a null to indicate that the router has either discarded the event of the event has been stored for further processing. A reaosn for storing the event might be that other events in it's correlation group are expected to be received. 2. Pass back an array of one or more events to be processed by the component. Often 1 event is returned, i.e. in the case of event aggregation. The router may return an array of events if a set of events have been resequenced or multiple events have been generated from a single event.

Specified by:
process in interface UMOInboundRouter
Overrides:
process in class SelectiveConsumer
Throws:
MessagingException

createEventGroup

protected EventGroup createEventGroup(UMOEvent event,
                                      Object groupId)
See Also:
AbstractEventAggregator.createEventGroup(UMOEvent, Object)

getEventGroupIdForEvent

protected Object getEventGroupIdForEvent(UMOEvent event)
See Also:
AbstractEventAggregator.getEventGroupIdForEvent(UMOEvent)

getEventGroup

protected EventGroup getEventGroup(Object groupId)
See Also:
AbstractEventAggregator.getEventGroup(Object)

addEventGroup

protected EventGroup addEventGroup(EventGroup group)
See Also:
AbstractEventAggregator.addEventGroup(EventGroup)

removeEventGroup

protected void removeEventGroup(EventGroup group)
See Also:
AbstractEventAggregator.removeEventGroup(EventGroup)

resequenceEvents

protected UMOEvent[] resequenceEvents(EventGroup events)
Reorder collected events according to the configured Comparator.

Parameters:
events - the EventGroup used for collecting the events
Returns:
an array of events reordered according to the Comparator returned by getComparator(). If no comparator is configured, the events are returned unsorted.

shouldResequenceEvents

protected abstract boolean shouldResequenceEvents(EventGroup events)
Determines whether the events in the passed EventGroup are ready to be reordered.

See Also:
AbstractEventAggregator.shouldAggregateEvents(EventGroup)


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