org.apache.synapse.mediators.eip.sample
Class SamplingThrottleMediator

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

public class SamplingThrottleMediator
extends AbstractMediator
implements ManagedLifecycle

This implements the well known Sample EIP (Enterprise Integration Pattern), which controls the flow of messages and limit the rate at which the messages are flowing through the sampler

Please note that the usage of this will require the sampler to be on the out-flow as well to correctly determine & to manage the rate.

See Also:
AbstractMediator

Field Summary
 
Fields inherited from class org.apache.synapse.mediators.AbstractMediator
log, trace, traceState
 
Constructor Summary
SamplingThrottleMediator()
           
 
Method Summary
 void destroy()
          This method should implement the destroying of the implemented parts of the configuration.
 String getId()
           
 MessageQueue getMessageQueue()
           
 int getSamplingRate()
           
 Target getTarget()
           
 long getUnitTime()
           
 void init(SynapseEnvironment synapseEnvironment)
          This method should implement the initialization of the implemented parts of the configuration.
 boolean isMessageQueueExplicitlySet()
           
 boolean mediate(MessageContext messageContext)
          Invokes the mediator passing the current message for mediation.
 void setId(String id)
           
 void setMessageQueue(MessageQueue messageQueue)
           
 void setSamplingRate(int samplingRate)
           
 void setTarget(Target target)
           
 void setUnitTime(long unitTime)
           
 
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

SamplingThrottleMediator

public SamplingThrottleMediator()
Method Detail

init

public void init(SynapseEnvironment synapseEnvironment)
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:
synapseEnvironment - 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 messageContext)
Description copied from interface: Mediator
Invokes the mediator passing the current message for mediation. Each mediator performs its mediation action, and returns true if mediation should continue, or false if further mediation should be aborted.

Specified by:
mediate in interface Mediator
Parameters:
messageContext - the current message for mediation
Returns:
true if further mediation should continue

getSamplingRate

public int getSamplingRate()

setSamplingRate

public void setSamplingRate(int samplingRate)

getId

public String getId()

setId

public void setId(String id)

getTarget

public Target getTarget()

setTarget

public void setTarget(Target target)

getUnitTime

public long getUnitTime()

setUnitTime

public void setUnitTime(long unitTime)

getMessageQueue

public MessageQueue getMessageQueue()

setMessageQueue

public void setMessageQueue(MessageQueue messageQueue)

isMessageQueueExplicitlySet

public boolean isMessageQueueExplicitlySet()


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