Class InterceptDefinition

All Implemented Interfaces:
org.apache.camel.CamelContextAware, org.apache.camel.LineNumberAware, Block, OutputNode, org.apache.camel.NamedNode, org.apache.camel.spi.HasCamelContext, org.apache.camel.spi.HasId, org.apache.camel.spi.IdAware
Direct Known Subclasses:
InterceptFromDefinition

@Metadata(label="configuration") public class InterceptDefinition extends OutputDefinition<InterceptDefinition>
Intercepts a message at each step in the route
  • Field Details

    • intercepted

      protected final List<org.apache.camel.Processor> intercepted
  • Constructor Details

    • InterceptDefinition

      public InterceptDefinition()
  • Method Details

    • toString

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

      public String getShortName()
      Specified by:
      getShortName in interface org.apache.camel.NamedNode
      Overrides:
      getShortName in class OutputDefinition<InterceptDefinition>
    • 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<InterceptDefinition>
    • isAbstract

      public boolean isAbstract()
      Description copied from class: ProcessorDefinition
      Whether this model is abstract or not.

      An abstract model is something that is used for configuring cross cutting concerns such as error handling, transaction policies, interceptors etc.

      Regular definitions is what is part of the route, such as ToDefinition, WireTapDefinition and the likes.

      Will by default return false to indicate regular definition, so all the abstract definitions must override this method and return true instead.

      This information is used in camel-spring to let Camel work a bit on the model provided by JAXB from the Spring XML file. This is needed to handle those cross cutting concerns properly. The Java DSL does not have this issue as it can work this out directly using the fluent builder methods.

      Overrides:
      isAbstract in class ProcessorDefinition<InterceptDefinition>
      Returns:
      true for abstract, otherwise false for regular.
    • isTopLevelOnly

      public boolean isTopLevelOnly()
      Description copied from class: ProcessorDefinition
      Whether this definition can only be added as top-level directly on the route itself (such as onException,onCompletion,intercept, etc.)

      If trying to add a top-level only definition to a nested output would fail in the ProcessorDefinition.addOutput(ProcessorDefinition) method.

      Overrides:
      isTopLevelOnly in class ProcessorDefinition<InterceptDefinition>
    • getOutputs

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

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

      public InterceptDefinition when(@AsPredicate org.apache.camel.Predicate predicate)
      Applies this interceptor only if the given predicate is true
      Parameters:
      predicate - the predicate
      Returns:
      the builder
    • afterPropertiesSet

      public void afterPropertiesSet()
      This method is only for handling some post configuration that is needed since this is an interceptor, and we have to do a bit of magic logic to fixup to handle predicates with or without proceed/stop set as well.
    • getIntercepted

      public List<org.apache.camel.Processor> getIntercepted()