Package org.apache.camel.model
Class SagaDefinition
- java.lang.Object
-
- org.apache.camel.model.OptionalIdentifiedDefinition<Type>
-
- org.apache.camel.model.ProcessorDefinition<Type>
-
- org.apache.camel.model.OutputDefinition<SagaDefinition>
-
- org.apache.camel.model.SagaDefinition
-
- All Implemented Interfaces:
org.apache.camel.CamelContextAware
,org.apache.camel.LineNumberAware
,Block
,OutputNode
,org.apache.camel.NamedNode
,org.apache.camel.spi.HasId
,org.apache.camel.spi.IdAware
@Metadata(label="eip,routing") public class SagaDefinition extends OutputDefinition<SagaDefinition>
Enables Sagas on the route
-
-
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 SagaDefinition()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description SagaDefinition
compensation(String compensation)
SagaDefinition
completion(String completion)
SagaDefinition
completionMode(String completionMode)
SagaDefinition
completionMode(SagaCompletionMode completionMode)
protected String
description()
SagaActionUriDefinition
getCompensation()
SagaActionUriDefinition
getCompletion()
String
getCompletionMode()
String
getLabel()
Returns a label to describe this node such as the expression if some kind of expression nodeList<PropertyExpressionDefinition>
getOptions()
String
getPropagation()
String
getSagaService()
org.apache.camel.saga.CamelSagaService
getSagaServiceBean()
String
getTimeout()
boolean
isAbstract()
Whether this model is abstract or not.boolean
isTopLevelOnly()
Whether this definition can only be added as top-level directly on the route itself (such as onException,onCompletion,intercept, etc.)boolean
isWrappingEntireOutput()
Whether this definition is wrapping the entire output.SagaDefinition
option(String option, org.apache.camel.Expression expression)
SagaDefinition
propagation(SagaPropagation propagation)
SagaDefinition
sagaService(String sagaService)
SagaDefinition
sagaService(org.apache.camel.saga.CamelSagaService sagaService)
void
setCompensation(SagaActionUriDefinition compensation)
The compensation endpoint URI that must be called to compensate all changes done in the route.void
setCompletion(SagaActionUriDefinition completion)
The completion endpoint URI that will be called when the Saga is completed successfully.void
setCompletionMode(String completionMode)
Determine how the saga should be considered complete.void
setOptions(List<PropertyExpressionDefinition> options)
Allows to save properties of the current exchange in order to re-use them in a compensation/completion callback route.void
setOutputs(List<ProcessorDefinition<?>> outputs)
void
setPropagation(String propagation)
Set the Saga propagation mode (REQUIRED, REQUIRES_NEW, MANDATORY, SUPPORTS, NOT_SUPPORTED, NEVER).void
setSagaService(String sagaService)
Refers to the id to lookup in the registry for the specific CamelSagaService to use.void
setTimeout(String timeout)
Set the maximum amount of time for the Saga.SagaDefinition
timeout(long timeout, TimeUnit unit)
SagaDefinition
timeout(String duration)
SagaDefinition
timeout(Duration duration)
String
toString()
-
Methods inherited from class org.apache.camel.model.OutputDefinition
getOutputs, getShortName
-
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, end, 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, 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, setParent, 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
-
setOutputs
public void setOutputs(List<ProcessorDefinition<?>> outputs)
- Overrides:
setOutputs
in classOutputDefinition<SagaDefinition>
-
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<SagaDefinition>
- 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<SagaDefinition>
-
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 classProcessorDefinition<SagaDefinition>
- Returns:
- true when wrapping the entire output.
-
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<SagaDefinition>
-
toString
public String toString()
- Overrides:
toString
in classOutputDefinition<SagaDefinition>
-
getSagaServiceBean
public org.apache.camel.saga.CamelSagaService getSagaServiceBean()
-
getSagaService
public String getSagaService()
-
setSagaService
public void setSagaService(String sagaService)
Refers to the id to lookup in the registry for the specific CamelSagaService to use.
-
getCompensation
public SagaActionUriDefinition getCompensation()
-
setCompensation
public void setCompensation(SagaActionUriDefinition compensation)
The compensation endpoint URI that must be called to compensate all changes done in the route. The route corresponding to the compensation URI must perform compensation and complete without error. If errors occur during compensation, the saga service may call again the compensation URI to retry.
-
getCompletion
public SagaActionUriDefinition getCompletion()
-
setCompletion
public void setCompletion(SagaActionUriDefinition completion)
The completion endpoint URI that will be called when the Saga is completed successfully. The route corresponding to the completion URI must perform completion tasks and terminate without error. If errors occur during completion, the saga service may call again the completion URI to retry.
-
getPropagation
public String getPropagation()
-
setPropagation
public void setPropagation(String propagation)
Set the Saga propagation mode (REQUIRED, REQUIRES_NEW, MANDATORY, SUPPORTS, NOT_SUPPORTED, NEVER).
-
getCompletionMode
public String getCompletionMode()
-
setCompletionMode
public void setCompletionMode(String completionMode)
Determine how the saga should be considered complete. When set to AUTO, the saga is completed when the exchange that initiates the saga is processed successfully, or compensated when it completes exceptionally. When set to MANUAL, the user must complete or compensate the saga using the "saga:complete" or "saga:compensate" endpoints.
-
getOptions
public List<PropertyExpressionDefinition> getOptions()
-
setOptions
public void setOptions(List<PropertyExpressionDefinition> options)
Allows to save properties of the current exchange in order to re-use them in a compensation/completion callback route. Options are usually helpful e.g. to store and retrieve identifiers of objects that should be deleted in compensating actions. Option values will be transformed into input headers of the compensation/completion exchange.
-
getTimeout
public String getTimeout()
-
setTimeout
public void setTimeout(String timeout)
Set the maximum amount of time for the Saga. After the timeout is expired, the saga will be compensated automatically (unless a different decision has been taken in the meantime).
-
compensation
public SagaDefinition compensation(String compensation)
-
completion
public SagaDefinition completion(String completion)
-
propagation
public SagaDefinition propagation(SagaPropagation propagation)
-
sagaService
public SagaDefinition sagaService(org.apache.camel.saga.CamelSagaService sagaService)
-
sagaService
public SagaDefinition sagaService(String sagaService)
-
completionMode
public SagaDefinition completionMode(SagaCompletionMode completionMode)
-
completionMode
public SagaDefinition completionMode(String completionMode)
-
option
public SagaDefinition option(String option, org.apache.camel.Expression expression)
-
timeout
public SagaDefinition timeout(Duration duration)
-
timeout
public SagaDefinition timeout(long timeout, TimeUnit unit)
-
timeout
public SagaDefinition timeout(String duration)
-
description
protected String description()
-
-