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

    Fields
    Modifier and Type
    Field
    Description
    static final int
     
    static final long
     

    Fields 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

    Constructors
    Constructor
    Description
    Resequencer(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 Type
    Method
    Description
    protected 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 void
     
    protected void
     
    protected void
     
    protected void
     
    int
     
    long
     
    org.apache.camel.Predicate
     
    org.apache.camel.spi.ExceptionHandler
     
    org.apache.camel.Expression
     
     
    int
     
    org.apache.camel.Processor
     
     
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    boolean
     
    List<org.apache.camel.Processor>
     
    protected void
    postProcess(org.apache.camel.Exchange exchange)
     
    boolean
    process(org.apache.camel.Exchange exchange, org.apache.camel.AsyncCallback callback)
    Enqueues an exchange for later batch processing.
    protected void
    processExchange(org.apache.camel.Exchange exchange)
    Strategy Method to process an exchange in the batch.
    void
    setAllowDuplicates(boolean allowDuplicates)
     
    void
    setBatchConsumer(boolean batchConsumer)
     
    void
    setBatchSize(int batchSize)
    Sets the in batch size.
    void
    setBatchTimeout(long batchTimeout)
     
    void
    setCompletionPredicate(org.apache.camel.Predicate completionPredicate)
     
    void
    setExceptionHandler(org.apache.camel.spi.ExceptionHandler exceptionHandler)
     
    void
    setGroupExchanges(boolean groupExchanges)
     
    void
     
    void
    setIgnoreInvalidExchanges(boolean ignoreInvalidExchanges)
     
    void
    setOutBatchSize(int outBatchSize)
    Sets the out batch size.
    void
    setReverse(boolean reverse)
     
    void
    setRouteId(String routeId)
     
     

    Methods inherited from class org.apache.camel.support.AsyncProcessorSupport

    process, processAsync

    Methods inherited from class org.apache.camel.support.service.BaseService

    build, doFail, doLifecycleChange, doResume, doShutdown, doSuspend, fail, getStatus, init, isBuild, isInit, isNew, isRunAllowed, isShutdown, isStarted, isStarting, isStartingOrStarted, isStopped, isStopping, isStoppingOrStopped, isSuspended, isSuspending, isSuspendingOrSuspended, resume, shutdown, start, stop, suspend

    Methods inherited from class java.lang.Object

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

    Methods inherited from interface org.apache.camel.spi.IdAware

    setGeneratedId

    Methods inherited from interface org.apache.camel.Service

    build, close, init, start, stop

    Methods inherited from interface org.apache.camel.ShutdownableService

    shutdown

    Methods inherited from interface org.apache.camel.StatefulService

    getStatus, isRunAllowed, isStarted, isStarting, isStopped, isStopping, isSuspending

    Methods inherited from interface org.apache.camel.SuspendableService

    isSuspended, resume, suspend
  • Field Details

  • 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

      public String toString()
      Overrides:
      toString in class Object
    • getTraceLabel

      public String getTraceLabel()
      Specified by:
      getTraceLabel in interface org.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 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)
    • 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

      public List<org.apache.camel.Processor> next()
      Specified by:
      next in interface org.apache.camel.Navigate<org.apache.camel.Processor>
    • hasNext

      public boolean hasNext()
      Specified by:
      hasNext in interface org.apache.camel.Navigate<org.apache.camel.Processor>
    • getId

      public String getId()
      Specified by:
      getId in interface org.apache.camel.spi.HasId
    • setId

      public void setId(String id)
      Specified by:
      setId in interface org.apache.camel.spi.IdAware
    • getRouteId

      public String getRouteId()
      Specified by:
      getRouteId in interface org.apache.camel.spi.RouteIdAware
    • setRouteId

      public void setRouteId(String routeId)
      Specified by:
      setRouteId in interface org.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

      protected void doBuild() throws Exception
      Overrides:
      doBuild in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doInit

      protected void doInit() throws Exception
      Overrides:
      doInit in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doStart

      protected void doStart() throws Exception
      Overrides:
      doStart in class org.apache.camel.support.service.BaseService
      Throws:
      Exception
    • doStop

      protected void doStop() throws Exception
      Overrides:
      doStop in class org.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:
      process in interface org.apache.camel.AsyncProcessor