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.EnclosedInlinedSequenceThe 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.
-
-
Constructor Summary
Constructors Constructor Description ThrottleMediator()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description voiddestroy()StringgetId()org.apache.axiom.om.OMElementgetInLinePolicy()getting throttle policy which has defined as InLineXMLorg.apache.synapse.MediatorgetInlineSequence(org.apache.synapse.config.SynapseConfiguration synCfg, int inlinedSeqIdentifier)static StringgetIp(Map<String,String> transportHeaderMap, org.apache.axis2.context.MessageContext axisMC)Extracts the remote IP from Message Context.org.apache.synapse.MediatorgetOnAcceptMediator()StringgetOnAcceptSeqKey()org.apache.synapse.MediatorgetOnRejectMediator()StringgetOnRejectSeqKey()StringgetPolicyKey()To get the policy key - The key for which will used to lookup policy from the registryvoidinit(org.apache.synapse.core.SynapseEnvironment se)booleanisContentAware()booleanmediate(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)voidsetId(String id)voidsetInLinePolicy(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 registry-
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, isContentAltering, isSkipEnabled, isStatisticsEnable, isTraceOn, isTraceOrDebugOn, isTracingEnabled, registerMediationFlowPoint, reportCloseStatistics, reportOpenStatistics, setBreakPoint, setCommentsList, setDescription, setEffectiveTraceState, setMediatorPosition, setShortDescription, setSkipEnabled, setTraceState, shouldCaptureTracing, shouldTrace, shouldTrace, traceOrDebug, traceOrDebugWarn, unregisterMediationFlowPoint
-
-
-
-
Method Detail
-
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
public String getPolicyKey()
To get the policy key - The key for which will used to lookup policy from the registry- Returns:
- String
-
setPolicyKey
public void setPolicyKey(String policyKey)
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
public String getOnRejectSeqKey()
-
setOnRejectSeqKey
public void setOnRejectSeqKey(String onRejectSeqKey)
-
getOnRejectMediator
public org.apache.synapse.Mediator getOnRejectMediator()
-
setOnRejectMediator
public void setOnRejectMediator(org.apache.synapse.Mediator onRejectMediator)
-
getOnAcceptSeqKey
public String getOnAcceptSeqKey()
-
setOnAcceptSeqKey
public void setOnAcceptSeqKey(String onAcceptSeqKey)
-
getOnAcceptMediator
public org.apache.synapse.Mediator getOnAcceptMediator()
-
setOnAcceptMediator
public void setOnAcceptMediator(org.apache.synapse.Mediator onAcceptMediator)
-
getId
public String getId()
-
setId
public void setId(String id)
-
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.
-
-