org.apache.camel.processor
Class BatchProcessor
java.lang.Object
org.apache.camel.impl.ServiceSupport
org.apache.camel.processor.BatchProcessor
- All Implemented Interfaces:
- Processor, Service
- Direct Known Subclasses:
- Aggregator, Resequencer
public class BatchProcessor
- extends ServiceSupport
- implements Processor
A base class for any kind of Processor
which implements some kind of batch processing.
- Version:
- $Revision: 765825 $
Methods inherited from class org.apache.camel.impl.ServiceSupport |
addChildService, getThreadName, getVersion, isRunAllowed, isStarted, isStarting, isStopped, isStopping, nextThreadCounter, removeChildService, start, stop |
DEFAULT_BATCH_TIMEOUT
public static final long DEFAULT_BATCH_TIMEOUT
- See Also:
- Constant Field Values
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE
- See Also:
- Constant Field Values
BatchProcessor
public BatchProcessor(Processor processor,
Collection<Exchange> collection)
toString
public String toString()
- Overrides:
toString
in class Object
getExceptionHandler
public ExceptionHandler getExceptionHandler()
setExceptionHandler
public void setExceptionHandler(ExceptionHandler exceptionHandler)
getBatchSize
public int getBatchSize()
setBatchSize
public void setBatchSize(int batchSize)
- Sets the in batch size. This is the number of incoming exchanges that this batch processor will
process before its completed. The default value is
DEFAULT_BATCH_SIZE
.
- Parameters:
batchSize
- the size
getOutBatchSize
public int getOutBatchSize()
setOutBatchSize
public void setOutBatchSize(int outBatchSize)
- Sets the out batch size. If the batch processor holds more exchanges than this out size then the
completion is triggered. Can for instance be used to ensure that this batch is completed when a certain
number of exchanges has been collected. By default this feature is not enabled.
- Parameters:
outBatchSize
- the size
getBatchTimeout
public long getBatchTimeout()
setBatchTimeout
public void setBatchTimeout(long batchTimeout)
getProcessor
public Processor getProcessor()
processExchange
protected void processExchange(Exchange exchange)
throws Exception
- Strategy Method to process an exchange in the batch. This method allows derived classes to perform
custom processing before or after an individual exchange is processed
- Throws:
Exception
doStart
protected void doStart()
throws Exception
- Specified by:
doStart
in class ServiceSupport
- Throws:
Exception
doStop
protected void doStop()
throws Exception
- Specified by:
doStop
in class ServiceSupport
- Throws:
Exception
process
public void process(Exchange exchange)
throws Exception
- Enqueues an exchange for later batch processing.
- Specified by:
process
in interface Processor
- Throws:
Exception
- if an internal processing error has occurred.
Copyright © 2009 Apache Software Foundation. All Rights Reserved.