Package org.apache.camel.model
Class OnCompletionDefinition
- java.lang.Object
-
- org.apache.camel.model.OptionalIdentifiedDefinition<Type>
-
- org.apache.camel.model.ProcessorDefinition<Type>
-
- 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.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
outputs
-
Fields inherited from class org.apache.camel.model.ProcessorDefinition
inheritErrorHandler
-
-
Constructor Summary
Constructors Constructor Description OnCompletionDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description ProcessorDefinition<?>end()Ends the current blockOnCompletionDefinitionexecutorService(String executorService)Refers to a custom Thread Pool to be used for parallel processing.OnCompletionDefinitionexecutorService(ExecutorService executorService)To use a custom Thread Pool to be used for parallel processing.StringgetExecutorService()ExecutorServicegetExecutorServiceBean()Gets the executor service for executingStringgetExecutorServiceRef()Gets a reference id to lookup the executor service from the registryStringgetLabel()Returns a label to describe this node such as the expression if some kind of expression nodeStringgetMode()StringgetOnCompleteOnly()StringgetOnFailureOnly()WhenDefinitiongetOnWhen()List<ProcessorDefinition<?>>getOutputs()StringgetParallelProcessing()StringgetShortName()StringgetUseOriginalMessage()booleanisAbstract()Whether this model is abstract or not.booleanisRouteScoped()booleanisTopLevelOnly()Whether this definition can only be added as top-level directly on the route itself (such as onException,onCompletion,intercept, etc.)OnCompletionDefinitionmodeAfterConsumer()Sets the mode to be after route is done (default due backwards compatible).OnCompletionDefinitionmodeBeforeConsumer()Sets the mode to be before consumer is done.OnCompletionDefinitiononCompleteOnly()Will only synchronize when theExchangecompleted successfully (no errors).OnCompletionDefinitiononFailureOnly()Will only synchronize when theExchangeended with failure (exception or FAULT message).OnCompletionDefinitiononWhen(org.apache.camel.Predicate predicate)Sets an additional predicate that should be true before the onCompletion is triggered.OnCompletionDefinitionparallelProcessing()If enabled then the on completion process will run asynchronously by a separate thread from a thread pool.OnCompletionDefinitionparallelProcessing(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)voidsetMode(String mode)Sets 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.StringtoString()OnCompletionDefinitionuseOriginalBody()Will use the original input message body 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, delay, delay, delay, 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, getIndex, getInterceptStrategies, getParent, getRouteConfiguration, id, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, 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, onCompletion, onException, onException, pausable, pausable, pausable, pausable, pipeline, 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, sample, script, script, serviceCall, serviceCall, serviceCall, setBody, setBody, setBody, setExchangePattern, setExchangePattern, setHeader, setHeader, setHeader, 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, to, to, toD, toD, toD, toD, toD, toD, toD, toF, transacted, transacted, transform, transform, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, unmarshal, validate, validate, validate, wireTap, wireTap, wireTap
-
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, description, getCamelContext, getCustomId, getDescription, getDescriptionText, getId, getLineNumber, getLocation, hasCustomIdAssigned, idOrCreate, setCamelContext, setCustomId, setDescription, setGeneratedId, setId, setLineNumber, setLocation
-
-
-
-
Method Detail
-
setRouteScoped
public void setRouteScoped(boolean routeScoped)
-
isRouteScoped
public boolean isRouteScoped()
-
setParent
public void setParent(ProcessorDefinition<?> parent)
- Overrides:
setParentin classProcessorDefinition<OnCompletionDefinition>
-
toString
public String toString()
- Overrides:
toStringin classOutputDefinition<OnCompletionDefinition>
-
getShortName
public String getShortName()
- Specified by:
getShortNamein interfaceorg.apache.camel.NamedNode- Overrides:
getShortNamein classOutputDefinition<OnCompletionDefinition>
-
getLabel
public String 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
public void removeAllOnCompletionDefinition(ProcessorDefinition<?> definition)
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
public ProcessorDefinition<?> end()
Description copied from class:ProcessorDefinitionEnds the current block- Overrides:
endin classProcessorDefinition<OnCompletionDefinition>- Returns:
- the builder
-
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 theExchangecompleted successfully (no errors).- Returns:
- the builder
-
onFailureOnly
public OnCompletionDefinition onFailureOnly()
Will only synchronize when theExchangeended 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 anExchangefor this on completion. By default this feature is off.- Returns:
- the builder
-
executorService
public OnCompletionDefinition executorService(ExecutorService 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
public OnCompletionDefinition executorService(String 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
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
-
getOutputs
public List<ProcessorDefinition<?>> getOutputs()
- Overrides:
getOutputsin classOutputDefinition<OnCompletionDefinition>
-
setOutputs
public void setOutputs(List<ProcessorDefinition<?>> outputs)
- Overrides:
setOutputsin classOutputDefinition<OnCompletionDefinition>
-
getExecutorServiceBean
public ExecutorService getExecutorServiceBean()
Description copied from interface:ExecutorServiceAwareDefinitionGets the executor service for executing- Specified by:
getExecutorServiceBeanin interfaceExecutorServiceAwareDefinition<OnCompletionDefinition>
-
getExecutorServiceRef
public String getExecutorServiceRef()
Description copied from interface:ExecutorServiceAwareDefinitionGets a reference id to lookup the executor service from the registry- Specified by:
getExecutorServiceRefin interfaceExecutorServiceAwareDefinition<OnCompletionDefinition>
-
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)
-
getOnWhen
public WhenDefinition getOnWhen()
-
setOnWhen
public void setOnWhen(WhenDefinition onWhen)
-
getUseOriginalMessage
public String getUseOriginalMessage()
-
setUseOriginalMessage
public void setUseOriginalMessage(String useOriginalMessage)
Will use the original input message body when anExchangefor 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)
-
-