Class TransactedDefinition

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

@Metadata(label="configuration") public class TransactedDefinition extends OutputDefinition<TransactedDefinition>
Enables transaction on the route
  • Field Details

  • Constructor Details

    • TransactedDefinition

      public TransactedDefinition()
    • TransactedDefinition

      public TransactedDefinition(org.apache.camel.spi.Policy policy)
  • Method Details

    • getOutputs

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

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

      public String toString()
      Overrides:
      toString in class OutputDefinition<TransactedDefinition>
    • description

      protected String description()
    • getShortName

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

      public boolean isWrappingEntireOutput()
      Description copied from class: ProcessorDefinition
      Whether this definition is wrapping the entire output.

      When a definition is wrapping the entire output, the check to ensure that a route definition is empty should be done on the wrapped output.

      Overrides:
      isWrappingEntireOutput in class ProcessorDefinition<TransactedDefinition>
      Returns:
      true when wrapping the entire output.
    • getPolicy

      public org.apache.camel.spi.Policy getPolicy()
    • getRef

      public String getRef()
    • setRef

      public void setRef(String ref)
    • getType

      public Class<? extends org.apache.camel.spi.Policy> getType()
    • setType

      public void setType(Class<? extends org.apache.camel.spi.Policy> type)
      Sets a policy type that this definition should scope within.

      Is used for convention over configuration situations where the policy should be automatic looked up in the registry and it should be based on this type. For instance a TransactedPolicy can be set as type for easy transaction configuration.

      Will by default scope to the wide Policy

      Parameters:
      type - the policy type
    • ref

      public TransactedDefinition ref(String ref)
      Sets a reference to use for lookup the policy in the registry.
      Parameters:
      ref - the reference
      Returns:
      the builder