Class AggregateMediator
- java.lang.Object
-
- org.apache.synapse.mediators.AbstractMediator
-
- org.apache.synapse.mediators.eip.aggregator.AggregateMediator
-
- All Implemented Interfaces:
AspectConfigurable
,ManagedLifecycle
,Mediator
,FlowContinuableMediator
,SynapseArtifact
public class AggregateMediator extends AbstractMediator implements ManagedLifecycle, FlowContinuableMediator
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
Constructors Constructor Description AggregateMediator()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description boolean
completeAggregate(Aggregate aggregate)
Invoked by the Aggregate objects that are timed out, to signal timeout/completion of itselfvoid
destroy()
This method should implement the destroying of the implemented parts of the configuration.Map
getActiveAggregates()
Value
getAggregateElementType()
SynapsePath
getAggregationExpression()
long
getCompletionTimeoutMillis()
SynapsePath
getCorrelateExpression()
String
getEnclosingElementPropertyName()
String
getId()
Value
getMaxMessagesToComplete()
Value
getMinMessagesToComplete()
SequenceMediator
getOnCompleteSequence()
String
getOnCompleteSequenceRef()
void
init(SynapseEnvironment se)
This method should implement the initialization of the implemented parts of the configuration.boolean
isContentAltering()
This is used to indicate whether message payload get modified during mediationboolean
mediate(MessageContext synCtx)
Aggregate messages flowing through this mediator according to the correlation criteria and the aggregation algorithm specified to itboolean
mediate(MessageContext synCtx, ContinuationState contState)
Mediate the message using a ContinuationState.Integer
reportOpenStatistics(MessageContext messageContext, boolean isContentAltering)
Report Open Statistic Event for the Mediatorvoid
setAggregateElementType(Value aggregateElementType)
void
setAggregationExpression(SynapsePath aggregationExpression)
void
setCompletionTimeoutMillis(long completionTimeoutMillis)
void
setComponentStatisticsId(ArtifactHolder holder)
void
setCorrelateExpression(SynapsePath correlateExpression)
void
setEnclosingElementPropertyName(String enclosingElementPropertyName)
void
setId(String id)
void
setMaxMessagesToComplete(Value maxMessagesToComplete)
void
setMinMessagesToComplete(Value minMessagesToComplete)
void
setOnCompleteSequence(SequenceMediator onCompleteSequence)
void
setOnCompleteSequenceRef(String onCompleteSequenceRef)
-
Methods inherited from class org.apache.synapse.mediators.AbstractMediator
auditLog, auditWarn, configure, disableStatistics, disableTracing, divertMediationRoute, enableStatistics, enableTracing, getAspectConfiguration, getCommentsList, getDescription, getInputType, getLastSequenceFaultHandler, getLog, getMediatorName, getMediatorPosition, getOutputType, getRegisteredMediationFlowPoint, getShortDescription, getTraceState, getType, handleException, handleException, isBreakPoint, isContentAware, isSkipEnabled, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, isTracingEnabled, registerMediationFlowPoint, reportCloseStatistics, setBreakPoint, setCommentsList, setDescription, setEffectiveTraceState, setMediatorPosition, setShortDescription, setSkipEnabled, setTraceState, shouldCaptureTracing, shouldTrace, shouldTrace, traceOrDebug, traceOrDebugWarn, unregisterMediationFlowPoint
-
-
-
-
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 interfaceManagedLifecycle
- 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 interfaceManagedLifecycle
-
mediate
public boolean mediate(MessageContext synCtx)
Aggregate messages flowing through this mediator according to the correlation criteria and the aggregation algorithm specified to it
-
mediate
public boolean mediate(MessageContext synCtx, ContinuationState contState)
Description copied from interface:FlowContinuableMediator
Mediate the message using a ContinuationState. This is used when mediating the response message when service is invoked using a Call Mediator.- Specified by:
mediate
in interfaceFlowContinuableMediator
- Parameters:
synCtx
- MessageContextcontState
- ContinuationState- Returns:
- whether mediation flow is completed
-
completeAggregate
public boolean 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 SynapsePath getCorrelateExpression()
-
setCorrelateExpression
public void setCorrelateExpression(SynapsePath correlateExpression)
-
getCompletionTimeoutMillis
public long getCompletionTimeoutMillis()
-
setCompletionTimeoutMillis
public void setCompletionTimeoutMillis(long completionTimeoutMillis)
-
getAggregationExpression
public SynapsePath getAggregationExpression()
-
setAggregationExpression
public void setAggregationExpression(SynapsePath 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)
-
getMinMessagesToComplete
public Value getMinMessagesToComplete()
-
setMinMessagesToComplete
public void setMinMessagesToComplete(Value minMessagesToComplete)
-
getMaxMessagesToComplete
public Value getMaxMessagesToComplete()
-
setMaxMessagesToComplete
public void setMaxMessagesToComplete(Value maxMessagesToComplete)
-
getEnclosingElementPropertyName
public String getEnclosingElementPropertyName()
-
setEnclosingElementPropertyName
public void setEnclosingElementPropertyName(String enclosingElementPropertyName)
-
getAggregateElementType
public Value getAggregateElementType()
-
setAggregateElementType
public void setAggregateElementType(Value aggregateElementType)
-
isContentAltering
public boolean isContentAltering()
Description copied from interface:Mediator
This is used to indicate whether message payload get modified during mediation- Specified by:
isContentAltering
in interfaceMediator
- Overrides:
isContentAltering
in classAbstractMediator
- Returns:
- whether mediator modify the payload
-
reportOpenStatistics
public Integer reportOpenStatistics(MessageContext messageContext, boolean isContentAltering)
Description copied from interface:Mediator
Report Open Statistic Event for the Mediator- Specified by:
reportOpenStatistics
in interfaceMediator
- Overrides:
reportOpenStatistics
in classAbstractMediator
-
setComponentStatisticsId
public void setComponentStatisticsId(ArtifactHolder holder)
- Specified by:
setComponentStatisticsId
in interfaceMediator
- Overrides:
setComponentStatisticsId
in classAbstractMediator
-
-