Class ThrottleMediator
java.lang.Object
org.apache.synapse.mediators.AbstractMediator
org.apache.synapse.mediators.throttle.ThrottleMediator
- All Implemented Interfaces:
org.apache.synapse.aspects.AspectConfigurable,org.apache.synapse.debug.constructs.EnclosedInlinedSequence,org.apache.synapse.ManagedLifecycle,org.apache.synapse.Mediator,org.apache.synapse.mediators.FlowContinuableMediator,org.apache.synapse.SynapseArtifact
public class ThrottleMediator
extends org.apache.synapse.mediators.AbstractMediator
implements org.apache.synapse.ManagedLifecycle, org.apache.synapse.mediators.FlowContinuableMediator, org.apache.synapse.debug.constructs.EnclosedInlinedSequence
The Mediator for the throttling - Throttling will occur according to the ws-policy
which is specified as the key for lookup from the registry or the inline policy
Throttling can be applied on IP or Domain of the remote caller.Now has support for either
Distributed or Standalone throttling schemes. Support two modes of throttling Concurrency and
Access rate based throttling In concurrency based throttling - throttling ignores remote callers
IP or Domains Considers only concurrent message flows at a given time. Access rate based
throttling is bound to a particular remote caller.
-
Field Summary
Fields inherited from class org.apache.synapse.mediators.AbstractMediator
log, trace, traceState -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoiddestroy()getId()org.apache.axiom.om.OMElementgetting throttle policy which has defined as InLineXMLorg.apache.synapse.MediatorgetInlineSequence(org.apache.synapse.config.SynapseConfiguration synCfg, int inlinedSeqIdentifier) static StringExtracts the remote IP from Message Context.org.apache.synapse.Mediatororg.apache.synapse.MediatorTo get the policy key - The key for which will used to lookup policy from the registryvoidinit(org.apache.synapse.core.SynapseEnvironment se) booleanbooleanmediate(org.apache.synapse.MessageContext synCtx) booleanmediate(org.apache.synapse.MessageContext synCtx, org.apache.synapse.ContinuationState continuationState) voidsetComponentStatisticsId(org.apache.synapse.aspects.flow.statistics.data.artifact.ArtifactHolder holder) voidvoidsetInLinePolicy(org.apache.axiom.om.OMElement inLinePolicy) setting throttle policy which has defined as InLineXMLvoidsetOnAcceptMediator(org.apache.synapse.Mediator onAcceptMediator) voidsetOnAcceptSeqKey(String onAcceptSeqKey) voidsetOnRejectMediator(org.apache.synapse.Mediator onRejectMediator) voidsetOnRejectSeqKey(String onRejectSeqKey) voidsetPolicyKey(String policyKey) To set the policy key - The key for which lookup from the registryMethods inherited from class org.apache.synapse.mediators.AbstractMediator
auditLog, auditWarn, configure, disableStatistics, disableTracing, divertMediationRoute, enableStatistics, enableTracing, getArtifactIdentifier, getAspectConfiguration, getCommentsList, getDescription, getInputType, getLastSequenceFaultHandler, getLog, getMediatorId, getMediatorName, getMediatorPosition, getOutputType, getRegisteredMediationFlowPoint, getShortDescription, getTraceState, getType, handleException, handleException, isBreakPoint, isContentAltering, isSkipEnabled, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, isTracingEnabled, registerMediationFlowPoint, reportCloseStatistics, reportCloseStatisticsWithError, reportOpenStatistics, setArtifactIdentifier, setBreakPoint, setCommentsList, setDescription, setEffectiveTraceState, setMediatorId, setMediatorPosition, setShortDescription, setSkipEnabled, setTraceState, shouldCaptureTracing, shouldTrace, shouldTrace, traceOrDebug, traceOrDebugWarn, unregisterMediationFlowPoint
-
Constructor Details
-
ThrottleMediator
public ThrottleMediator()
-
-
Method Details
-
mediate
public boolean mediate(org.apache.synapse.MessageContext synCtx) - Specified by:
mediatein interfaceorg.apache.synapse.Mediator
-
mediate
public boolean mediate(org.apache.synapse.MessageContext synCtx, org.apache.synapse.ContinuationState continuationState) - Specified by:
mediatein interfaceorg.apache.synapse.mediators.FlowContinuableMediator
-
init
public void init(org.apache.synapse.core.SynapseEnvironment se) - Specified by:
initin interfaceorg.apache.synapse.ManagedLifecycle
-
destroy
public void destroy()- Specified by:
destroyin interfaceorg.apache.synapse.ManagedLifecycle
-
getPolicyKey
To get the policy key - The key for which will used to lookup policy from the registry- Returns:
- String
-
setPolicyKey
To set the policy key - The key for which lookup from the registry- Parameters:
policyKey- Value for picking policy from the registry
-
getInLinePolicy
public org.apache.axiom.om.OMElement getInLinePolicy()getting throttle policy which has defined as InLineXML- Returns:
- InLine Throttle Policy
-
setInLinePolicy
public void setInLinePolicy(org.apache.axiom.om.OMElement inLinePolicy) setting throttle policy which has defined as InLineXML- Parameters:
inLinePolicy- Inline policy
-
getOnRejectSeqKey
-
setOnRejectSeqKey
-
getOnRejectMediator
public org.apache.synapse.Mediator getOnRejectMediator() -
setOnRejectMediator
public void setOnRejectMediator(org.apache.synapse.Mediator onRejectMediator) -
getOnAcceptSeqKey
-
setOnAcceptSeqKey
-
getOnAcceptMediator
public org.apache.synapse.Mediator getOnAcceptMediator() -
setOnAcceptMediator
public void setOnAcceptMediator(org.apache.synapse.Mediator onAcceptMediator) -
getId
-
setId
-
isContentAware
public boolean isContentAware()- Specified by:
isContentAwarein interfaceorg.apache.synapse.Mediator- Overrides:
isContentAwarein classorg.apache.synapse.mediators.AbstractMediator
-
getInlineSequence
public org.apache.synapse.Mediator getInlineSequence(org.apache.synapse.config.SynapseConfiguration synCfg, int inlinedSeqIdentifier) - Specified by:
getInlineSequencein interfaceorg.apache.synapse.debug.constructs.EnclosedInlinedSequence
-
setComponentStatisticsId
public void setComponentStatisticsId(org.apache.synapse.aspects.flow.statistics.data.artifact.ArtifactHolder holder) - Specified by:
setComponentStatisticsIdin interfaceorg.apache.synapse.Mediator- Overrides:
setComponentStatisticsIdin classorg.apache.synapse.mediators.AbstractMediator
-
getIp
public static String getIp(Map<String, String> transportHeaderMap, org.apache.axis2.context.MessageContext axisMC) Extracts the remote IP from Message Context.- Parameters:
transportHeaderMap- Message contextaxisMC- org.apache.axis2.context.MessageContext - Axis2 Message Context.- Returns:
- IP as a String.
-