Package org.apache.camel.processor
Class Resequencer
java.lang.Object
org.apache.camel.support.service.BaseService
org.apache.camel.support.service.ServiceSupport
org.apache.camel.support.AsyncProcessorSupport
org.apache.camel.processor.Resequencer
- All Implemented Interfaces:
AutoCloseable,org.apache.camel.AsyncProcessor,org.apache.camel.Navigate<org.apache.camel.Processor>,org.apache.camel.Processor,org.apache.camel.Service,org.apache.camel.ShutdownableService,org.apache.camel.spi.HasId,org.apache.camel.spi.IdAware,org.apache.camel.spi.RouteIdAware,org.apache.camel.StatefulService,org.apache.camel.SuspendableService,org.apache.camel.Traceable
public class Resequencer
extends org.apache.camel.support.AsyncProcessorSupport
implements org.apache.camel.Navigate<org.apache.camel.Processor>, org.apache.camel.spi.IdAware, org.apache.camel.spi.RouteIdAware, org.apache.camel.Traceable
An implementation of the Resequencer which can reorder
messages within a batch.
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intstatic final longFields inherited from class org.apache.camel.support.service.BaseService
BUILT, FAILED, INITIALIZED, INITIALIZING, lock, NEW, SHUTDOWN, SHUTTING_DOWN, STARTED, STARTING, status, STOPPED, STOPPING, SUSPENDED, SUSPENDING -
Constructor Summary
ConstructorsConstructorDescriptionResequencer(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor processor, Set<org.apache.camel.Exchange> collection, org.apache.camel.Expression expression) Resequencer(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor processor, org.apache.camel.Expression expression) Resequencer(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor processor, org.apache.camel.Expression expression, boolean allowDuplicates, boolean reverse) -
Method Summary
Modifier and TypeMethodDescriptionprotected static Set<org.apache.camel.Exchange> createSet(Comparator<? super org.apache.camel.Exchange> comparator, boolean allowDuplicates, boolean reverse) protected static Set<org.apache.camel.Exchange> createSet(org.apache.camel.Expression expression, boolean allowDuplicates, boolean reverse) protected voiddoBuild()protected voiddoInit()protected voiddoStart()protected voiddoStop()intlongorg.apache.camel.Predicateorg.apache.camel.spi.ExceptionHandlerorg.apache.camel.ExpressiongetId()intorg.apache.camel.ProcessorbooleanhasNext()booleanbooleanbooleanbooleanbooleanList<org.apache.camel.Processor> next()protected voidpostProcess(org.apache.camel.Exchange exchange) booleanprocess(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) Enqueues an exchange for later batch processing.protected voidprocessExchange(org.apache.camel.Exchange exchange) Strategy Method to process an exchange in the batch.voidsetAllowDuplicates(boolean allowDuplicates) voidsetBatchConsumer(boolean batchConsumer) voidsetBatchSize(int batchSize) Sets the in batch size.voidsetBatchTimeout(long batchTimeout) voidsetCompletionPredicate(org.apache.camel.Predicate completionPredicate) voidsetExceptionHandler(org.apache.camel.spi.ExceptionHandler exceptionHandler) voidsetGroupExchanges(boolean groupExchanges) voidvoidsetIgnoreInvalidExchanges(boolean ignoreInvalidExchanges) voidsetOutBatchSize(int outBatchSize) Sets the out batch size.voidsetReverse(boolean reverse) voidsetRouteId(String routeId) toString()Methods inherited from class org.apache.camel.support.AsyncProcessorSupport
process, processAsyncMethods inherited from class org.apache.camel.support.service.BaseService
build, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getInternalLock, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspendMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface org.apache.camel.spi.IdAware
setGeneratedIdMethods inherited from interface org.apache.camel.Service
build, close, init, start, stopMethods inherited from interface org.apache.camel.ShutdownableService
shutdownMethods inherited from interface org.apache.camel.StatefulService
getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspendingMethods inherited from interface org.apache.camel.SuspendableService
isSuspended, resume, suspend
-
Field Details
-
DEFAULT_BATCH_TIMEOUT
public static final long DEFAULT_BATCH_TIMEOUT- See Also:
-
DEFAULT_BATCH_SIZE
public static final int DEFAULT_BATCH_SIZE- See Also:
-
-
Constructor Details
-
Resequencer
public Resequencer(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor processor, org.apache.camel.Expression expression) -
Resequencer
public Resequencer(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor processor, org.apache.camel.Expression expression, boolean allowDuplicates, boolean reverse) -
Resequencer
public Resequencer(org.apache.camel.CamelContext camelContext, org.apache.camel.Processor processor, Set<org.apache.camel.Exchange> collection, org.apache.camel.Expression expression)
-
-
Method Details
-
toString
-
getTraceLabel
- Specified by:
getTraceLabelin interfaceorg.apache.camel.Traceable
-
getExpression
public org.apache.camel.Expression getExpression() -
getExceptionHandler
public org.apache.camel.spi.ExceptionHandler getExceptionHandler() -
setExceptionHandler
public void setExceptionHandler(org.apache.camel.spi.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 isDEFAULT_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) -
isGroupExchanges
public boolean isGroupExchanges() -
setGroupExchanges
public void setGroupExchanges(boolean groupExchanges) -
isBatchConsumer
public boolean isBatchConsumer() -
setBatchConsumer
public void setBatchConsumer(boolean batchConsumer) -
isIgnoreInvalidExchanges
public boolean isIgnoreInvalidExchanges() -
setIgnoreInvalidExchanges
public void setIgnoreInvalidExchanges(boolean ignoreInvalidExchanges) -
isReverse
public boolean isReverse() -
setReverse
public void setReverse(boolean reverse) -
isAllowDuplicates
public boolean isAllowDuplicates() -
setAllowDuplicates
public void setAllowDuplicates(boolean allowDuplicates) -
getCompletionPredicate
public org.apache.camel.Predicate getCompletionPredicate() -
setCompletionPredicate
public void setCompletionPredicate(org.apache.camel.Predicate completionPredicate) -
getProcessor
public org.apache.camel.Processor getProcessor() -
next
- Specified by:
nextin interfaceorg.apache.camel.Navigate<org.apache.camel.Processor>
-
hasNext
public boolean hasNext()- Specified by:
hasNextin interfaceorg.apache.camel.Navigate<org.apache.camel.Processor>
-
getId
- Specified by:
getIdin interfaceorg.apache.camel.spi.HasId
-
setId
- Specified by:
setIdin interfaceorg.apache.camel.spi.IdAware
-
getRouteId
- Specified by:
getRouteIdin interfaceorg.apache.camel.spi.RouteIdAware
-
setRouteId
- Specified by:
setRouteIdin interfaceorg.apache.camel.spi.RouteIdAware
-
createSet
protected static Set<org.apache.camel.Exchange> createSet(org.apache.camel.Expression expression, boolean allowDuplicates, boolean reverse) -
createSet
protected static Set<org.apache.camel.Exchange> createSet(Comparator<? super org.apache.camel.Exchange> comparator, boolean allowDuplicates, boolean reverse) -
processExchange
protected void processExchange(org.apache.camel.Exchange exchange) 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 -
postProcess
protected void postProcess(org.apache.camel.Exchange exchange) -
doBuild
- Overrides:
doBuildin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doInit
- Overrides:
doInitin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStart
- Overrides:
doStartin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
doStop
- Overrides:
doStopin classorg.apache.camel.support.service.BaseService- Throws:
Exception
-
process
public boolean process(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback) Enqueues an exchange for later batch processing.- Specified by:
processin interfaceorg.apache.camel.AsyncProcessor
-