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

java.lang.Object
  extended by java.util.TimerTask
      extended by org.apache.synapse.mediators.eip.aggregator.Aggregate
All Implemented Interfaces:
Runnable

public class Aggregate
extends TimerTask

An instance of this class is created to manage each aggregation group, and it holds the aggregation properties and the messages collected during aggregation. This class also times out itself after the timeout expires it


Constructor Summary
Aggregate(SynapseEnvironment synEnv, String corelation, long timeoutMillis, int min, int max, AggregateMediator mediator)
          Save aggregation properties and timeout
 
Method Summary
 boolean addMessage(MessageContext synCtx)
          Add a message to the interlan message list
 String getCorrelation()
           
 long getExpiryTimeMillis()
           
 boolean getLock()
           
 int getMaxCount()
           
 List<MessageContext> getMessages()
           
 int getMinCount()
           
 long getTimeoutMillis()
           
 boolean isComplete(SynapseLog synLog)
          Has this aggregation group completed?
 boolean isCompleted()
           
 void releaseLock()
           
 void run()
           
 void setCompleted(boolean completed)
           
 void setCorrelation(String correlation)
           
 void setExpiryTimeMillis(long expiryTimeMillis)
           
 void setMaxCount(int maxCount)
           
 void setMessages(List<MessageContext> messages)
           
 void setMinCount(int minCount)
           
 void setTimeoutMillis(long timeoutMillis)
           
 
Methods inherited from class java.util.TimerTask
cancel, scheduledExecutionTime
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Aggregate

public Aggregate(SynapseEnvironment synEnv,
                 String corelation,
                 long timeoutMillis,
                 int min,
                 int max,
                 AggregateMediator mediator)
Save aggregation properties and timeout

Parameters:
corelation - representing the corelation name of the messages in the aggregate
timeoutMillis - the timeout duration in milliseconds
min - the minimum number of messages to be aggregated
max - the maximum number of messages to be aggregated
mediator -
Method Detail

addMessage

public boolean addMessage(MessageContext synCtx)
Add a message to the interlan message list

Parameters:
synCtx - message to be added into this aggregation group
Returns:
true if the message was added or false if not

isComplete

public boolean isComplete(SynapseLog synLog)
Has this aggregation group completed?

Parameters:
synLog - the Synapse log to use
Returns:
boolean true if aggregation is complete

getTimeoutMillis

public long getTimeoutMillis()

setTimeoutMillis

public void setTimeoutMillis(long timeoutMillis)

getMinCount

public int getMinCount()

setMinCount

public void setMinCount(int minCount)

getMaxCount

public int getMaxCount()

setMaxCount

public void setMaxCount(int maxCount)

getCorrelation

public String getCorrelation()

setCorrelation

public void setCorrelation(String correlation)

getMessages

public List<MessageContext> getMessages()

setMessages

public void setMessages(List<MessageContext> messages)

getExpiryTimeMillis

public long getExpiryTimeMillis()

setExpiryTimeMillis

public void setExpiryTimeMillis(long expiryTimeMillis)

run

public void run()
Specified by:
run in interface Runnable
Specified by:
run in class TimerTask

getLock

public boolean getLock()

releaseLock

public void releaseLock()

isCompleted

public boolean isCompleted()

setCompleted

public void setCompleted(boolean completed)


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