org.apache.camel.processor
Class SamplingThrottler

java.lang.Object
  extended by org.apache.camel.impl.ServiceSupport
      extended by org.apache.camel.processor.DelegateProcessor
          extended by org.apache.camel.processor.SamplingThrottler
All Implemented Interfaces:
Navigate<Processor>, Processor, Service

public class SamplingThrottler
extends DelegateProcessor

A SamplingThrottler is a special kind of throttler. It also limits the number of exchanges sent to a downstream endpoint. It differs from a normal throttler in that it will not queue exchanges above the threshold for a given period. Instead these exchanges will be stopped, precluding them from being processed at all by downstream consumers.

This kind of throttling can be useful for taking a sample from an exchange stream, rough consolidation of noisy and bursty exchange traffic or where queuing of throttled exchanges is undesirable.

Version:
$Revision: 885283 $

Field Summary
protected  org.apache.commons.logging.Log log
           
 
Fields inherited from class org.apache.camel.processor.DelegateProcessor
processor
 
Constructor Summary
SamplingThrottler(Processor processor, long samplePeriod, TimeUnit units)
           
 
Method Summary
 String getTraceLabel()
           
 void process(Exchange exchange)
          Processes the message exchange
 String toString()
           
 
Methods inherited from class org.apache.camel.processor.DelegateProcessor
doStart, doStop, getProcessor, hasNext, next, proceed, processNext, setProcessor
 
Methods inherited from class org.apache.camel.impl.ServiceSupport
addChildService, getStatus, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, removeChildService, start, stop
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

log

protected final transient org.apache.commons.logging.Log log
Constructor Detail

SamplingThrottler

public SamplingThrottler(Processor processor,
                         long samplePeriod,
                         TimeUnit units)
Method Detail

toString

public String toString()
Overrides:
toString in class DelegateProcessor

getTraceLabel

public String getTraceLabel()

process

public void process(Exchange exchange)
             throws Exception
Description copied from interface: Processor
Processes the message exchange

Specified by:
process in interface Processor
Overrides:
process in class DelegateProcessor
Parameters:
exchange - the message exchange
Throws:
Exception - if an internal processing error has occurred.


Copyright © 2007-2010 The Apache Software Foundation. All Rights Reserved.