org.apache.synapse.mediators.eip.aggregator
Class AggregateMediator

java.lang.Object
  extended by org.apache.synapse.mediators.AbstractMediator
      extended by org.apache.synapse.mediators.eip.aggregator.AggregateMediator
All Implemented Interfaces:
AspectConfigurable, ManagedLifecycle, Mediator, SynapseArtifact

public class AggregateMediator
extends AbstractMediator
implements ManagedLifecycle

Aggregate a number of messages that are determined to be for a particular group, and combine them to form a single message which is then processed through the 'onComplete' sequence. Thus an aggregator acts like a filter, and may look at a correlation XPath expression to select messages for aggregation - or look at messageSequence number properties for aggregation or let any other (i.e. non aggregatable) messages flow through An instance of this mediator will register with a Timer to be notified after a specified timeout, so that aggregations that never would complete could be timed out and cleared from memory and any fault conditions handled


Field Summary
 
Fields inherited from class org.apache.synapse.mediators.AbstractMediator
trace, traceState
 
Constructor Summary
AggregateMediator()
           
 
Method Summary
 void completeAggregate(Aggregate aggregate)
          Invoked by the Aggregate objects that are timed out, to signal timeout/completion of itself
 void destroy()
          This method should implement the destroying of the implemented parts of the configuration.
 Map getActiveAggregates()
           
 SynapseXPath getAggregationExpression()
           
 long getCompletionTimeoutMillis()
           
 SynapseXPath getCorrelateExpression()
           
 String getId()
           
 int getMaxMessagesToComplete()
           
 int getMinMessagesToComplete()
           
 SequenceMediator getOnCompleteSequence()
           
 String getOnCompleteSequenceRef()
           
 void init(SynapseEnvironment se)
          This method should implement the initialization of the implemented parts of the configuration.
 boolean mediate(MessageContext synCtx)
          Aggregate messages flowing through this mediator according to the correlation criteria and the aggregation algorithm specified to it
 void setAggregationExpression(SynapseXPath aggregationExpression)
           
 void setCompletionTimeoutMillis(long completionTimeoutMillis)
           
 void setCorrelateExpression(SynapseXPath correlateExpression)
           
 void setId(String id)
           
 void setMaxMessagesToComplete(int maxMessagesToComplete)
           
 void setMinMessagesToComplete(int minMessagesToComplete)
           
 void setOnCompleteSequence(SequenceMediator onCompleteSequence)
           
 void setOnCompleteSequenceRef(String onCompleteSequenceRef)
           
 
Methods inherited from class org.apache.synapse.mediators.AbstractMediator
auditLog, auditWarn, configure, disableStatistics, enableStatistics, getAspectConfiguration, getDescription, getLog, getTraceState, getType, handleException, handleException, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, setDescription, setEffectiveTraceState, setTraceState, shouldTrace, traceOrDebug, traceOrDebugWarn
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AggregateMediator

public AggregateMediator()
Method Detail

init

public void init(SynapseEnvironment se)
Description copied from interface: ManagedLifecycle
This method should implement the initialization of the implemented parts of the configuration.

Specified by:
init in interface ManagedLifecycle
Parameters:
se - SynapseEnvironment to be used for initialization

destroy

public void destroy()
Description copied from interface: ManagedLifecycle
This method should implement the destroying of the implemented parts of the configuration.

Specified by:
destroy in interface ManagedLifecycle

mediate

public boolean mediate(MessageContext synCtx)
Aggregate messages flowing through this mediator according to the correlation criteria and the aggregation algorithm specified to it

Specified by:
mediate in interface Mediator
Parameters:
synCtx - - MessageContext to be mediated and aggregated
Returns:
boolean true if the complete condition for the particular aggregate is validated

completeAggregate

public void completeAggregate(Aggregate aggregate)
Invoked by the Aggregate objects that are timed out, to signal timeout/completion of itself

Parameters:
aggregate - the timed out Aggregate that holds collected messages and properties

getCorrelateExpression

public SynapseXPath getCorrelateExpression()

setCorrelateExpression

public void setCorrelateExpression(SynapseXPath correlateExpression)

getCompletionTimeoutMillis

public long getCompletionTimeoutMillis()

setCompletionTimeoutMillis

public void setCompletionTimeoutMillis(long completionTimeoutMillis)

getMinMessagesToComplete

public int getMinMessagesToComplete()

setMinMessagesToComplete

public void setMinMessagesToComplete(int minMessagesToComplete)

getMaxMessagesToComplete

public int getMaxMessagesToComplete()

setMaxMessagesToComplete

public void setMaxMessagesToComplete(int maxMessagesToComplete)

getAggregationExpression

public SynapseXPath getAggregationExpression()

setAggregationExpression

public void setAggregationExpression(SynapseXPath aggregationExpression)

getOnCompleteSequenceRef

public String getOnCompleteSequenceRef()

setOnCompleteSequenceRef

public void setOnCompleteSequenceRef(String onCompleteSequenceRef)

getOnCompleteSequence

public SequenceMediator getOnCompleteSequence()

setOnCompleteSequence

public void setOnCompleteSequence(SequenceMediator onCompleteSequence)

getActiveAggregates

public Map getActiveAggregates()

getId

public String getId()

setId

public void setId(String id)


Copyright © 2005-2012 Apache Software Foundation. All Rights Reserved.