Class ResequenceDefinition

All Implemented Interfaces:
org.apache.camel.CamelContextAware, org.apache.camel.LineNumberAware, Block, HasExpressionType, OutputNode, org.apache.camel.NamedNode, org.apache.camel.spi.HasCamelContext, org.apache.camel.spi.HasId, org.apache.camel.spi.IdAware

@Metadata(label="eip,routing") public class ResequenceDefinition extends OutputDefinition<ResequenceDefinition> implements HasExpressionType
Resequences (re-order) messages based on an expression
  • Constructor Details

    • ResequenceDefinition

      public ResequenceDefinition()
    • ResequenceDefinition

      public ResequenceDefinition(org.apache.camel.Expression expression)
  • Method Details

    • getOutputs

      public List<ProcessorDefinition<?>> getOutputs()
      Overrides:
      getOutputs in class OutputDefinition<ResequenceDefinition>
    • setOutputs

      public void setOutputs(List<ProcessorDefinition<?>> outputs)
      Overrides:
      setOutputs in class OutputDefinition<ResequenceDefinition>
    • stream

      public ResequenceDefinition stream()
      Configures the stream-based resequencing algorithm using the default configuration.
      Returns:
      the builder
    • batch

      public ResequenceDefinition batch()
      Configures the batch-based resequencing algorithm using the default configuration.
      Returns:
      the builder
    • stream

      Configures the stream-based resequencing algorithm using the given StreamResequencerConfig.
      Parameters:
      config - the config
      Returns:
      the builder
    • batch

      Configures the batch-based resequencing algorithm using the given BatchResequencerConfig.
      Parameters:
      config - the config
      Returns:
      the builder
    • timeout

      public ResequenceDefinition timeout(long timeout)
      Sets the timeout
      Parameters:
      timeout - timeout in millis
      Returns:
      the builder
    • timeout

      public ResequenceDefinition timeout(Duration timeout)
      Sets the timeout
      Parameters:
      timeout - timeout
      Returns:
      the builder
    • timeout

      public ResequenceDefinition timeout(String timeout)
      Sets the timeout
      Parameters:
      timeout - timeout
      Returns:
      the builder
    • deliveryAttemptInterval

      public ResequenceDefinition deliveryAttemptInterval(long deliveryAttemptInterval)
      Sets the interval in milli seconds the stream resequencer will at most wait while waiting for condition of being able to deliver.
      Parameters:
      deliveryAttemptInterval - interval in millis
      Returns:
      the builder
    • rejectOld

      public ResequenceDefinition rejectOld()
      Sets the rejectOld flag to throw an error when a message older than the last delivered message is processed
      Returns:
      the builder
    • size

      public ResequenceDefinition size(int batchSize)
      Sets the in batch size for number of exchanges received
      Parameters:
      batchSize - the batch size
      Returns:
      the builder
    • capacity

      public ResequenceDefinition capacity(int capacity)
      Sets the capacity for the stream resequencer
      Parameters:
      capacity - the capacity
      Returns:
      the builder
    • allowDuplicates

      public ResequenceDefinition allowDuplicates()
      Enables duplicates for the batch resequencer mode
      Returns:
      the builder
    • reverse

      public ResequenceDefinition reverse()
      Enables reverse mode for the batch resequencer mode.

      This means the expression for determine the sequence order will be reversed. Can be used for Z..A or 9..0 ordering.

      Returns:
      the builder
    • ignoreInvalidExchanges

      public ResequenceDefinition ignoreInvalidExchanges()
      If an incoming Exchange is invalid, then it will be ignored.
      Returns:
      builder
    • comparator

      public ResequenceDefinition comparator(org.apache.camel.processor.resequencer.ExpressionResultComparator comparator)
      Sets the comparator to use for stream resequencer
      Parameters:
      comparator - the comparator
      Returns:
      the builder
    • toString

      public String toString()
      Overrides:
      toString in class OutputDefinition<ResequenceDefinition>
    • getShortName

      public String getShortName()
      Specified by:
      getShortName in interface org.apache.camel.NamedNode
      Overrides:
      getShortName in class OutputDefinition<ResequenceDefinition>
    • getLabel

      public String getLabel()
      Description copied from class: ProcessorDefinition
      Returns a label to describe this node such as the expression if some kind of expression node
      Specified by:
      getLabel in interface org.apache.camel.NamedNode
      Overrides:
      getLabel in class ProcessorDefinition<ResequenceDefinition>
    • getResequencerConfig

      public ResequencerConfig getResequencerConfig()
    • setResequencerConfig

      public void setResequencerConfig(ResequencerConfig resequencerConfig)
      To configure the resequencer in using either batch or stream configuration. Will by default use batch configuration.
    • getBatchConfig

      public BatchResequencerConfig getBatchConfig()
    • getStreamConfig

      public StreamResequencerConfig getStreamConfig()
    • setBatchConfig

      public void setBatchConfig(BatchResequencerConfig batchConfig)
    • setStreamConfig

      public void setStreamConfig(StreamResequencerConfig streamConfig)
    • getExpression

      public ExpressionDefinition getExpression()
    • setExpression

      public void setExpression(ExpressionDefinition expression)
      Expression to use for re-ordering the messages, such as a header with a sequence number
    • setExpression

      public void setExpression(org.apache.camel.Expression expression)
      Expression to use for re-ordering the messages, such as a header with a sequence number
    • getExpressionType

      public ExpressionDefinition getExpressionType()
      Description copied from interface: HasExpressionType
      Gets the expression definition
      Specified by:
      getExpressionType in interface HasExpressionType
    • setExpressionType

      public void setExpressionType(ExpressionDefinition expressionType)
      Expression to use for re-ordering the messages, such as a header with a sequence number
      Specified by:
      setExpressionType in interface HasExpressionType