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 blockOnCompletionDefinition
executorService(String executorService)
Refers to a custom Thread Pool to be used for parallel processing.OnCompletionDefinition
executorService(ExecutorService executorService)
To use a custom Thread Pool to be used for parallel processing.String
getExecutorService()
ExecutorService
getExecutorServiceBean()
Gets the executor service for executingString
getExecutorServiceRef()
Gets a reference id to lookup the executor service from the registryString
getLabel()
Returns a label to describe this node such as the expression if some kind of expression nodeString
getMode()
String
getOnCompleteOnly()
String
getOnFailureOnly()
WhenDefinition
getOnWhen()
List<ProcessorDefinition<?>>
getOutputs()
String
getParallelProcessing()
String
getShortName()
String
getUseOriginalMessage()
boolean
isAbstract()
Whether this model is abstract or not.boolean
isRouteScoped()
boolean
isTopLevelOnly()
Whether this definition can only be added as top-level directly on the route itself (such as onException,onCompletion,intercept, etc.)OnCompletionDefinition
modeAfterConsumer()
Sets the mode to be after route is done (default due backwards compatible).OnCompletionDefinition
modeBeforeConsumer()
Sets the mode to be before consumer is done.OnCompletionDefinition
onCompleteOnly()
Will only synchronize when theExchange
completed successfully (no errors).OnCompletionDefinition
onFailureOnly()
Will only synchronize when theExchange
ended with failure (exception or FAULT message).OnCompletionDefinition
onWhen(org.apache.camel.Predicate predicate)
Sets an additional predicate that should be true before the onCompletion is triggered.OnCompletionDefinition
parallelProcessing()
If enabled then the on completion process will run asynchronously by a separate thread from a thread pool.OnCompletionDefinition
parallelProcessing(boolean parallelProcessing)
If enabled then the on completion process will run asynchronously by a separate thread from a thread pool.void
removeAllOnCompletionDefinition(ProcessorDefinition<?> definition)
Removes all existing globalOnCompletionDefinition
from the definition.void
setExecutorService(String executorService)
void
setMode(String mode)
Sets the on completion mode.void
setOnCompleteOnly(String onCompleteOnly)
void
setOnFailureOnly(String onFailureOnly)
void
setOnWhen(WhenDefinition onWhen)
void
setOutputs(List<ProcessorDefinition<?>> outputs)
void
setParallelProcessing(String parallelProcessing)
void
setParent(ProcessorDefinition<?> parent)
void
setRouteScoped(boolean routeScoped)
void
setUseOriginalMessage(String useOriginalMessage)
Will use the original input message body when anExchange
for this on completion.String
toString()
OnCompletionDefinition
useOriginalBody()
Will use the original input message body when anExchange
for 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, 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:
setParent
in classProcessorDefinition<OnCompletionDefinition>
-
toString
public String toString()
- Overrides:
toString
in classOutputDefinition<OnCompletionDefinition>
-
getShortName
public String getShortName()
- Specified by:
getShortName
in interfaceorg.apache.camel.NamedNode
- Overrides:
getShortName
in classOutputDefinition<OnCompletionDefinition>
-
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 interfaceorg.apache.camel.NamedNode
- Overrides:
getLabel
in classProcessorDefinition<OnCompletionDefinition>
-
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 classProcessorDefinition<OnCompletionDefinition>
- 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 theProcessorDefinition.addOutput(ProcessorDefinition)
method.- Overrides:
isTopLevelOnly
in classProcessorDefinition<OnCompletionDefinition>
-
removeAllOnCompletionDefinition
public void removeAllOnCompletionDefinition(ProcessorDefinition<?> definition)
Removes all existing globalOnCompletionDefinition
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
-
end
public ProcessorDefinition<?> end()
Description copied from class:ProcessorDefinition
Ends the current block- Overrides:
end
in 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 theExchange
completed successfully (no errors).- Returns:
- the builder
-
onFailureOnly
public OnCompletionDefinition onFailureOnly()
Will only synchronize when theExchange
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 anExchange
for 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:
executorService
in 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:
executorService
in interfaceExecutorServiceAwareDefinition<OnCompletionDefinition>
- Parameters:
executorService
- reference for aExecutorService
to 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:
getOutputs
in classOutputDefinition<OnCompletionDefinition>
-
setOutputs
public void setOutputs(List<ProcessorDefinition<?>> outputs)
- Overrides:
setOutputs
in classOutputDefinition<OnCompletionDefinition>
-
getExecutorServiceBean
public ExecutorService getExecutorServiceBean()
Description copied from interface:ExecutorServiceAwareDefinition
Gets the executor service for executing- Specified by:
getExecutorServiceBean
in interfaceExecutorServiceAwareDefinition<OnCompletionDefinition>
-
getExecutorServiceRef
public String getExecutorServiceRef()
Description copied from interface:ExecutorServiceAwareDefinition
Gets a reference id to lookup the executor service from the registry- Specified by:
getExecutorServiceRef
in 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 anExchange
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)
-
-