org.apache.camel.processor
Class BatchProcessor
java.lang.Object
org.apache.camel.impl.ServiceSupport
org.apache.camel.processor.BatchProcessor
- All Implemented Interfaces:
- Runnable, Service
- Direct Known Subclasses:
- Aggregator, Resequencer
public class BatchProcessor
- extends ServiceSupport
- implements Runnable
A base class for any kind of Processor
which implements some kind of
batch processing.
- Version:
- $Revision: 35332 $
Methods inherited from class org.apache.camel.impl.ServiceSupport |
addChildService, getThreadName, 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(Endpoint endpoint,
Processor processor,
Collection<Exchange> collection)
toString
public String toString()
- Overrides:
toString
in class Object
run
public void run()
- Specified by:
run
in interface Runnable
getExceptionHandler
public ExceptionHandler getExceptionHandler()
setExceptionHandler
public void setExceptionHandler(ExceptionHandler exceptionHandler)
getBatchSize
public int getBatchSize()
setBatchSize
public void setBatchSize(int batchSize)
getBatchTimeout
public long getBatchTimeout()
setBatchTimeout
public void setBatchTimeout(long batchTimeout)
getEndpoint
public Endpoint getEndpoint()
getProcessor
public Processor getProcessor()
processBatch
protected void processBatch()
throws Exception
- A transactional method to process a batch of messages up to a timeout
period or number of messages reached.
- Throws:
Exception
isBatchCompleted
protected boolean isBatchCompleted(int index)
- A strategy method to decide if the batch is completed the resulting exchanges should be sent
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
getCollection
protected Collection<Exchange> getCollection()
Copyright © 2008 IONA Open Source Community. All Rights Reserved.