Package org.apache.synapse.mediators.throttle

# 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.mediators.MediatorWithChildren`, `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, org.apache.synapse.mediators.MediatorWithChildren
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
  Constructor
  Description
  `ThrottleMediator()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `destroy()`
  `List<org.apache.synapse.mediators.ChildSequence>`
  `getChildren()`
  `String`
  `getId()`
  `org.apache.axiom.om.OMElement`
  `getInLinePolicy()`
  getting throttle policy which has defined as InLineXML
  `org.apache.synapse.Mediator`
  `getInlineSequence(org.apache.synapse.config.SynapseConfiguration synCfg, int inlinedSeqIdentifier)`
  `static String`
  `getIp(Map<String,String> transportHeaderMap, org.apache.axis2.context.MessageContext axisMC)`
  Extracts the remote IP from Message Context.
  `org.apache.synapse.Mediator`
  `getOnAcceptMediator()`
  `String`
  `getOnAcceptSeqKey()`
  `org.apache.synapse.Mediator`
  `getOnRejectMediator()`
  `String`
  `getOnRejectSeqKey()`
  `String`
  `getPolicyKey()`
  To get the policy key - The key for which will used to lookup policy from the registry
  `void`
  `init(org.apache.synapse.core.SynapseEnvironment se)`
  `boolean`
  `isContentAware()`
  `boolean`
  `mediate(org.apache.synapse.MessageContext synCtx)`
  `boolean`
  `mediate(org.apache.synapse.MessageContext synCtx, org.apache.synapse.ContinuationState continuationState)`
  `void`
  `setComponentStatisticsId(org.apache.synapse.aspects.flow.statistics.data.artifact.ArtifactHolder holder)`
  `void`
  `setId(String id)`
  `void`
  `setInLinePolicy(org.apache.axiom.om.OMElement inLinePolicy)`
  setting throttle policy which has defined as InLineXML
  `void`
  `setOnAcceptMediator(org.apache.synapse.Mediator onAcceptMediator)`
  `void`
  `setOnAcceptSeqKey(String onAcceptSeqKey)`
  `void`
  `setOnRejectMediator(org.apache.synapse.Mediator onRejectMediator)`
  `void`
  `setOnRejectSeqKey(String onRejectSeqKey)`
  `void`
  `setPolicyKey(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, 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`

  ### Methods inherited from class java.lang.Object

  `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### ThrottleMediator

    public ThrottleMediator()

- ## Method Details

  - ### mediate

    public boolean mediate(org.apache.synapse.MessageContext synCtx)
    Specified by:
      `mediate` in interface `org.apache.synapse.Mediator`

  - ### mediate

    public boolean mediate(org.apache.synapse.MessageContext synCtx, org.apache.synapse.ContinuationState continuationState)
    Specified by:
      `mediate` in interface `org.apache.synapse.mediators.FlowContinuableMediator`

  - ### init

    public void init(org.apache.synapse.core.SynapseEnvironment se)
    Specified by:
      `init` in interface `org.apache.synapse.ManagedLifecycle`

  - ### destroy

    public void destroy()
    Specified by:
      `destroy` in interface `org.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:
      `isContentAware` in interface `org.apache.synapse.Mediator`
    Overrides:
      `isContentAware` in class `org.apache.synapse.mediators.AbstractMediator`

  - ### getInlineSequence

    public org.apache.synapse.Mediator getInlineSequence(org.apache.synapse.config.SynapseConfiguration synCfg, int inlinedSeqIdentifier)
    Specified by:
      `getInlineSequence` in interface `org.apache.synapse.debug.constructs.EnclosedInlinedSequence`

  - ### setComponentStatisticsId

    public void setComponentStatisticsId(org.apache.synapse.aspects.flow.statistics.data.artifact.ArtifactHolder holder)
    Specified by:
      `setComponentStatisticsId` in interface `org.apache.synapse.Mediator`
    Overrides:
      `setComponentStatisticsId` in class `org.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 context
      `axisMC` - org.apache.axis2.context.MessageContext - Axis2 Message Context.
    Returns:
      IP as a String.

  - ### getChildren

    public List<org.apache.synapse.mediators.ChildSequence> getChildren()
    Specified by:
      `getChildren` in interface `org.apache.synapse.mediators.MediatorWithChildren`