Class OnCompletionDefinition

    • Constructor Detail

      • OnCompletionDefinition

        public OnCompletionDefinition()
    • Method Detail

      • setRouteScoped

        public void setRouteScoped​(boolean routeScoped)
      • isRouteScoped

        public boolean isRouteScoped()
      • 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<OnCompletionDefinition>
        Returns:
        true for abstract, otherwise false for regular.
      • removeAllOnCompletionDefinition

        public void removeAllOnCompletionDefinition​(ProcessorDefinition<?> definition)
        Removes all existing global OnCompletionDefinition from the definition.

        This is used to let route scoped onCompletion overrule any global onCompletion. Do not remove an existing route-scoped because it is now possible (CAMEL-16374) to have several.

        Parameters:
        definition - the parent definition that is the route
      • modeAfterConsumer

        public OnCompletionDefinition modeAfterConsumer()
        Sets the mode to be after route is done (default due backwards compatible).

        This executes the on completion work after the route consumer have written response back to the callee (if its InOut mode).

        Returns:
        the builder
      • modeBeforeConsumer

        public OnCompletionDefinition modeBeforeConsumer()
        Sets the mode to be before consumer is done.

        This allows the on completion work to execute before the route consumer, writes any response back to the callee (if its InOut mode).

        Returns:
        the builder
      • onCompleteOnly

        public OnCompletionDefinition onCompleteOnly()
        Will only synchronize when the Exchange completed successfully (no errors).
        Returns:
        the builder
      • onFailureOnly

        public OnCompletionDefinition onFailureOnly()
        Will only synchronize when the Exchange ended with failure (exception or FAULT message).
        Returns:
        the builder
      • onWhen

        public OnCompletionDefinition onWhen​(@AsPredicate
                                             org.apache.camel.Predicate predicate)
        Sets an additional predicate that should be true before the onCompletion is triggered.

        To be used for fine grained controlling whether a completion callback should be invoked or not

        Parameters:
        predicate - predicate that determines true or false
        Returns:
        the builder
      • useOriginalBody

        public OnCompletionDefinition useOriginalBody()
        Will use the original input message body when an Exchange for this on completion.

        By default this feature is off.

        Returns:
        the builder
      • parallelProcessing

        public OnCompletionDefinition parallelProcessing()
        If enabled then the on completion process will run asynchronously by a separate thread from a thread pool. By default this is false, meaning the on completion process will run synchronously using the same caller thread as from the route.
        Returns:
        the builder
      • parallelProcessing

        public OnCompletionDefinition parallelProcessing​(boolean parallelProcessing)
        If enabled then the on completion process will run asynchronously by a separate thread from a thread pool. By default this is false, meaning the on completion process will run synchronously using the same caller thread as from the route.
        Returns:
        the builder
      • getMode

        public String getMode()
      • setMode

        public void setMode​(String mode)
        Sets the on completion mode.

        The default value is AfterConsumer

      • getOnCompleteOnly

        public String getOnCompleteOnly()
      • setOnCompleteOnly

        public void setOnCompleteOnly​(String onCompleteOnly)
      • getOnFailureOnly

        public String getOnFailureOnly()
      • setOnFailureOnly

        public void setOnFailureOnly​(String onFailureOnly)
      • getUseOriginalMessage

        public String getUseOriginalMessage()
      • setUseOriginalMessage

        public void setUseOriginalMessage​(String useOriginalMessage)
        Will use the original input message body when an Exchange for this on completion.

        By default this feature is off.

      • getParallelProcessing

        public String getParallelProcessing()
      • setParallelProcessing

        public void setParallelProcessing​(String parallelProcessing)
      • getExecutorService

        public String getExecutorService()
      • setExecutorService

        public void setExecutorService​(String executorService)