Package org.apache.camel.model
Class OnCompletionDefinition
java.lang.Object
org.apache.camel.model.OptionalIdentifiedDefinition<OnCompletionDefinition>
org.apache.camel.model.ProcessorDefinition<OnCompletionDefinition>
org.apache.camel.model.OutputDefinition<OnCompletionDefinition>
org.apache.camel.model.OnCompletionDefinition
- All Implemented Interfaces:
org.apache.camel.CamelContextAware,org.apache.camel.LineNumberAware,Block,ExecutorServiceAwareDefinition<OnCompletionDefinition>,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 OnCompletionDefinition
extends OutputDefinition<OnCompletionDefinition>
implements ExecutorServiceAwareDefinition<OnCompletionDefinition>
Route to be executed when normal route processing completes
-
Field Summary
Fields inherited from class org.apache.camel.model.OutputDefinition
outputsFields inherited from class org.apache.camel.model.ProcessorDefinition
disabled, inheritErrorHandler -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionend()Ends the current blockexecutorService(String executorService) Refers to a custom Thread Pool to be used for parallel processing.executorService(ExecutorService executorService) To use a custom Thread Pool to be used for parallel processing.Gets the executor service for executingGets a reference id to lookup the executor service from the registrygetLabel()Returns a label to describe this node such as the expression if some kind of expression nodegetMode()booleanWhether this model is abstract or not.booleanbooleanWhether this definition can only be added as top-level directly on the route itself (such as onException,onCompletion,intercept, etc.)Sets the mode to be after route is done (default due backwards compatible).Sets the mode to be before consumer is done.Will only synchronize when theExchangecompleted successfully (no errors).Will only synchronize when theExchangeended with failure (exception or FAULT message).onWhen(org.apache.camel.Predicate predicate) Sets an additional predicate that should be true before the onCompletion is triggered.If enabled then the on completion process will run asynchronously by a separate thread from a thread pool.parallelProcessing(boolean parallelProcessing) If enabled then the on completion process will run asynchronously by a separate thread from a thread pool.voidremoveAllOnCompletionDefinition(ProcessorDefinition<?> definition) Removes all existing globalOnCompletionDefinitionfrom the definition.voidsetExecutorService(String executorService) voidSets the on completion mode.voidsetOnCompleteOnly(String onCompleteOnly) voidsetOnFailureOnly(String onFailureOnly) voidsetOnWhen(WhenDefinition onWhen) voidsetOutputs(List<ProcessorDefinition<?>> outputs) voidsetParallelProcessing(String parallelProcessing) voidsetParent(ProcessorDefinition<?> parent) voidsetRouteScoped(boolean routeScoped) voidsetUseOriginalMessage(String useOriginalMessage) Will use the original input message body when anExchangefor this on completion.toString()Deprecated.Will use the original input message when anExchangefor this on completion.Methods inherited from class org.apache.camel.model.ProcessorDefinition
addInterceptStrategy, addOutput, aggregate, aggregate, aggregate, aggregate, bean, bean, bean, bean, bean, bean, bean, bean, bean, bean, bean, choice, circuitBreaker, claimCheck, claimCheck, claimCheck, claimCheck, clearOutput, configureChild, convertBodyTo, convertBodyTo, convertBodyTo, convertHeaderTo, convertHeaderTo, convertHeaderTo, delay, delay, delay, disabled, disabled, disabled, doTry, dynamicRouter, dynamicRouter, endChoice, endCircuitBreaker, endDoCatch, endDoTry, endParent, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, filter, filter, filter, filter, getDisabled, getIndex, getInterceptStrategies, getParent, getRouteConfiguration, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, isInheritErrorHandler, isWrappingEntireOutput, kamelet, loadBalance, loadBalance, log, log, log, log, log, log, loop, loop, loop, loopDoWhile, loopDoWhile, markRollbackOnly, markRollbackOnlyLast, marshal, marshal, marshal, marshal, multicast, multicast, multicast, nodePrefixId, onCompletion, onException, onException, onException, onException, pausable, pausable, pausable, pausable, pipeline, pipeline, pipeline, policy, policy, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrich, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, pollEnrichWith, preCreateProcessor, process, process, process, recipientList, recipientList, recipientList, recipientList, removeHeader, removeHeaders, removeHeaders, removeProperties, removeProperties, removeProperty, resequence, resequence, resumable, resumable, resumable, rollback, rollback, routeDescription, routeGroup, routeId, routingSlip, routingSlip, routingSlip, saga, sample, sample, sample, sample, script, script, serviceCall, serviceCall, serviceCall, setBody, setBody, setBody, setDisabled, setExchangePattern, setExchangePattern, setHeader, setHeader, setHeader, setHeaders, setInheritErrorHandler, setProperty, setProperty, setProperty, setRouteConfiguration, sort, sort, sort, split, split, split, split, startupOrder, step, step, stop, threads, threads, threads, threads, throttle, throttle, throttle, throttle, throttle, throwException, throwException, to, to, to, to, to, to, to, to, to, to, to, to, toD, toD, toD, toD, toD, toD, toD, toF, transacted, transacted, transform, transform, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTapMethods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, getCamelContext, getCustomId, getDescription, getDescriptionText, getId, getLineNumber, getLocation, getNodePrefixId, hasCustomIdAssigned, idOrCreate, setCamelContext, setCustomId, setDescription, setGeneratedId, setId, setLineNumber, setLocation
-
Constructor Details
-
OnCompletionDefinition
public OnCompletionDefinition()
-
-
Method Details
-
setRouteScoped
public void setRouteScoped(boolean routeScoped) -
isRouteScoped
public boolean isRouteScoped() -
setParent
- Overrides:
setParentin classProcessorDefinition<OnCompletionDefinition>
-
toString
- Overrides:
toStringin classOutputDefinition<OnCompletionDefinition>
-
getShortName
- Specified by:
getShortNamein interfaceorg.apache.camel.NamedNode- Overrides:
getShortNamein classOutputDefinition<OnCompletionDefinition>
-
getLabel
Description copied from class:ProcessorDefinitionReturns a label to describe this node such as the expression if some kind of expression node- Specified by:
getLabelin interfaceorg.apache.camel.NamedNode- Overrides:
getLabelin classProcessorDefinition<OnCompletionDefinition>
-
isAbstract
public boolean isAbstract()Description copied from class:ProcessorDefinitionWhether 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:
isAbstractin classProcessorDefinition<OnCompletionDefinition>- Returns:
- true for abstract, otherwise false for regular.
-
isTopLevelOnly
public boolean isTopLevelOnly()Description copied from class:ProcessorDefinitionWhether 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 theProcessorDefinition.addOutput(ProcessorDefinition)method.- Overrides:
isTopLevelOnlyin classProcessorDefinition<OnCompletionDefinition>
-
removeAllOnCompletionDefinition
Removes all existing globalOnCompletionDefinitionfrom 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
-
end
Description copied from class:ProcessorDefinitionEnds the current block- Overrides:
endin classProcessorDefinition<OnCompletionDefinition>- Returns:
- the builder
-
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
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
Will only synchronize when theExchangecompleted successfully (no errors).- Returns:
- the builder
-
onFailureOnly
Will only synchronize when theExchangeended with failure (exception or FAULT message).- Returns:
- the builder
-
onWhen
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
Deprecated.Will use the original input message body when anExchangefor this on completion. The original input message is defensively copied, and the copied message body is converted toStreamCacheif possible (stream caching is enabled, can be disabled globally or on the original route), to ensure the body can be read when the original message is being used later. If the body is converted toStreamCachethen the message body on the currentExchangeis replaced with theStreamCachebody. If the body is not converted toStreamCachethen the body will not be able to re-read when accessed later. Important: The original input means the input message that are bounded by the currentUnitOfWork. An unit of work typically spans one route, or multiple routes if they are connected using internal endpoints such as direct or seda. When messages is passed via external endpoints such as JMS or HTTP then the consumer will create a new unit of work, with the message it received as input as the original input. Also some EIP patterns such as splitter, multicast, will create a new unit of work boundary for the messages in their sub-route (eg the split message); however these EIPs have an option named shareUnitOfWork which allows to combine with the parent unit of work in regard to error handling and therefore use the parent original message. By default this feature is off.- Returns:
- the builder
-
useOriginalMessage
Will use the original input message when anExchangefor this on completion. The original input message is defensively copied, and the copied message body is converted toStreamCacheif possible (stream caching is enabled, can be disabled globally or on the original route), to ensure the body can be read when the original message is being used later. If the body is converted toStreamCachethen the message body on the currentExchangeis replaced with theStreamCachebody. If the body is not converted toStreamCachethen the body will not be able to re-read when accessed later. Important: The original input means the input message that are bounded by the currentUnitOfWork. An unit of work typically spans one route, or multiple routes if they are connected using internal endpoints such as direct or seda. When messages is passed via external endpoints such as JMS or HTTP then the consumer will create a new unit of work, with the message it received as input as the original input. Also some EIP patterns such as splitter, multicast, will create a new unit of work boundary for the messages in their sub-route (eg the split message); however these EIPs have an option named shareUnitOfWork which allows to combine with the parent unit of work in regard to error handling and therefore use the parent original message. By default this feature is off.- Returns:
- the builder
-
executorService
To use a custom Thread Pool to be used for parallel processing. Notice if you set this option, then parallel processing is automatic implied, and you do not have to enable that option as well.- Specified by:
executorServicein interfaceExecutorServiceAwareDefinition<OnCompletionDefinition>- Parameters:
executorService- the executor service- Returns:
- the builder
-
executorService
Refers to a custom Thread Pool to be used for parallel processing. Notice if you set this option, then parallel processing is automatic implied, and you do not have to enable that option as well.- Specified by:
executorServicein interfaceExecutorServiceAwareDefinition<OnCompletionDefinition>- Parameters:
executorService- reference for aExecutorServiceto lookup in theRegistry- Returns:
- the builder
-
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
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
-
getOutputs
- Overrides:
getOutputsin classOutputDefinition<OnCompletionDefinition>
-
setOutputs
- Overrides:
setOutputsin classOutputDefinition<OnCompletionDefinition>
-
getExecutorServiceBean
Description copied from interface:ExecutorServiceAwareDefinitionGets the executor service for executing- Specified by:
getExecutorServiceBeanin interfaceExecutorServiceAwareDefinition<OnCompletionDefinition>
-
getExecutorServiceRef
Description copied from interface:ExecutorServiceAwareDefinitionGets a reference id to lookup the executor service from the registry- Specified by:
getExecutorServiceRefin interfaceExecutorServiceAwareDefinition<OnCompletionDefinition>
-
getMode
-
setMode
Sets the on completion mode. The default value is AfterConsumer -
getOnCompleteOnly
-
setOnCompleteOnly
-
getOnFailureOnly
-
setOnFailureOnly
-
getOnWhen
-
setOnWhen
-
getUseOriginalMessage
-
setUseOriginalMessage
Will use the original input message body when anExchangefor this on completion. The original input message is defensively copied, and the copied message body is converted toStreamCacheif possible (stream caching is enabled, can be disabled globally or on the original route), to ensure the body can be read when the original message is being used later. If the body is converted toStreamCachethen the message body on the currentExchangeis replaced with theStreamCachebody. If the body is not converted toStreamCachethen the body will not be able to re-read when accessed later. Important: The original input means the input message that are bounded by the currentUnitOfWork. An unit of work typically spans one route, or multiple routes if they are connected using internal endpoints such as direct or seda. When messages is passed via external endpoints such as JMS or HTTP then the consumer will create a new unit of work, with the message it received as input as the original input. Also some EIP patterns such as splitter, multicast, will create a new unit of work boundary for the messages in their sub-route (eg the split message); however these EIPs have an option named shareUnitOfWork which allows to combine with the parent unit of work in regard to error handling and therefore use the parent original message. By default this feature is off. -
getParallelProcessing
-
setParallelProcessing
-
getExecutorService
-
setExecutorService
-
useOriginalMessage()