Class 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
    • 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
      • 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 interface FlowContinuableMediator
        Parameters:
        synCtx - MessageContext
        contState - 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)
      • 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 interface Mediator
        Overrides:
        isContentAltering in class AbstractMediator
        Returns:
        whether mediator modify the payload