Package org.apache.camel.model
Class IdempotentConsumerDefinition
- java.lang.Object
-
- org.apache.camel.model.OptionalIdentifiedDefinition<Type>
-
- org.apache.camel.model.ProcessorDefinition<ExpressionNode>
-
- org.apache.camel.model.ExpressionNode
-
- org.apache.camel.model.OutputExpressionNode
-
- org.apache.camel.model.IdempotentConsumerDefinition
-
- All Implemented Interfaces:
Block
,HasExpressionType
,OutputNode
,org.apache.camel.NamedNode
,org.apache.camel.spi.HasId
,org.apache.camel.spi.IdAware
@Metadata(label="eip,routing") public class IdempotentConsumerDefinition extends OutputExpressionNode
Filters out duplicate messages
-
-
Field Summary
-
Fields inherited from class org.apache.camel.model.ProcessorDefinition
inheritErrorHandler, log
-
-
Constructor Summary
Constructors Constructor Description IdempotentConsumerDefinition()
IdempotentConsumerDefinition(org.apache.camel.Expression messageIdExpression, org.apache.camel.spi.IdempotentRepository idempotentRepository)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description IdempotentConsumerDefinition
completionEager(boolean completionEager)
Sets whether to complete the idempotent consumer eager or when the exchange is done.IdempotentConsumerDefinition
eager(boolean eager)
Sets whether to eagerly add the key to the idempotent repository or wait until the exchange is complete.String
getCompletionEager()
String
getEager()
String
getLabel()
Returns a label to describe this node such as the expression if some kind of expression nodeorg.apache.camel.spi.IdempotentRepository
getMessageIdRepository()
String
getMessageIdRepositoryRef()
String
getRemoveOnFailure()
String
getShortName()
String
getSkipDuplicate()
IdempotentConsumerDefinition
messageIdRepository(Supplier<org.apache.camel.spi.IdempotentRepository> idempotentRepository)
Sets the message id repository for the idempotent consumerIdempotentConsumerDefinition
messageIdRepository(org.apache.camel.spi.IdempotentRepository idempotentRepository)
Sets the message id repository for the idempotent consumerIdempotentConsumerDefinition
messageIdRepositoryRef(String messageIdRepositoryRef)
Sets the reference name of the message id repositoryIdempotentConsumerDefinition
removeOnFailure(boolean removeOnFailure)
Sets whether to remove or keep the key on failure.void
setCompletionEager(String completionEager)
void
setEager(String eager)
void
setExpression(ExpressionDefinition expression)
Expression used to calculate the correlation key to use for duplicate check.void
setMessageIdRepository(org.apache.camel.spi.IdempotentRepository idempotentRepository)
void
setMessageIdRepositoryRef(String messageIdRepositoryRef)
void
setRemoveOnFailure(String removeOnFailure)
void
setSkipDuplicate(String skipDuplicate)
IdempotentConsumerDefinition
skipDuplicate(boolean skipDuplicate)
Sets whether to skip duplicates or not.String
toString()
-
Methods inherited from class org.apache.camel.model.OutputExpressionNode
getOutputs, setOutputs
-
Methods inherited from class org.apache.camel.model.ExpressionNode
configureChild, getExpression, getExpressionType, id, preCreateProcessor, setExpression, setExpressionType
-
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, convertBodyTo, convertBodyTo, convertBodyTo, delay, delay, delay, doTry, dynamicRouter, dynamicRouter, end, endChoice, endCircuitBreaker, endDoCatch, endDoTry, endParent, endRest, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrich, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, enrichWith, filter, filter, filter, filter, getIndex, getInterceptStrategies, getParent, idempotentConsumer, idempotentConsumer, idempotentConsumer, inheritErrorHandler, inOnly, inOnly, inOnly, inOnly, inOnly, inOut, inOut, inOut, inOut, inOut, isAbstract, isInheritErrorHandler, isTopLevelOnly, 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, 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, process, process, process, recipientList, recipientList, recipientList, recipientList, removeHeader, removeHeaders, removeHeaders, removeProperties, removeProperties, removeProperty, resequence, resequence, rollback, rollback, routeDescription, routeGroup, routeId, routingSlip, routingSlip, routingSlip, saga, sample, sample, sample, sample, script, script, serviceCall, serviceCall, serviceCall, setBody, setBody, setBody, setExchangePattern, setHeader, setHeader, setHeader, setInheritErrorHandler, setParent, setProperty, setProperty, setProperty, 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, validate, validate, validate, wireTap, wireTap, wireTap
-
Methods inherited from class org.apache.camel.model.OptionalIdentifiedDefinition
description, description, getCustomId, getDescription, getDescriptionText, getId, hasCustomIdAssigned, idOrCreate, setCustomId, setDescription, setGeneratedId, setId
-
-
-
-
Method Detail
-
getShortName
public String getShortName()
-
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 classExpressionNode
-
messageIdRepositoryRef
public IdempotentConsumerDefinition messageIdRepositoryRef(String messageIdRepositoryRef)
Sets the reference name of the message id repository- Parameters:
messageIdRepositoryRef
- the reference name of message id repository- Returns:
- builder
-
messageIdRepository
public IdempotentConsumerDefinition messageIdRepository(org.apache.camel.spi.IdempotentRepository idempotentRepository)
Sets the message id repository for the idempotent consumer- Parameters:
idempotentRepository
- the repository instance of idempotent- Returns:
- builder
-
messageIdRepository
public IdempotentConsumerDefinition messageIdRepository(Supplier<org.apache.camel.spi.IdempotentRepository> idempotentRepository)
Sets the message id repository for the idempotent consumer- Parameters:
idempotentRepository
- the repository instance of idempotent- Returns:
- builder
-
eager
public IdempotentConsumerDefinition eager(boolean eager)
Sets whether to eagerly add the key to the idempotent repository or wait until the exchange is complete. Eager is default enabled.- Parameters:
eager
- true to add the key before processing, false to wait until the exchange is complete.- Returns:
- builder
-
completionEager
public IdempotentConsumerDefinition completionEager(boolean completionEager)
Sets whether to complete the idempotent consumer eager or when the exchange is done. If this option is true to complete eager, then the idempotent consumer will trigger its completion when the exchange reached the end of the block of the idempotent consumer pattern. So if the exchange is continued routed after the block ends, then whatever happens there does not affect the state. If this option is false (default) to not complete eager, then the idempotent consumer will complete when the exchange is done being routed. So if the exchange is continued routed after the block ends, then whatever happens there also affect the state. For example if the exchange failed due to an exception, then the state of the idempotent consumer will be a rollback.- Parameters:
completionEager
- whether to complete eager or complete when the exchange is done- Returns:
- builder
-
removeOnFailure
public IdempotentConsumerDefinition removeOnFailure(boolean removeOnFailure)
Sets whether to remove or keep the key on failure. The default behavior is to remove the key on failure.- Parameters:
removeOnFailure
- true to remove the key, false to keep the key if the exchange fails.- Returns:
- builder
-
skipDuplicate
public IdempotentConsumerDefinition skipDuplicate(boolean skipDuplicate)
Sets whether to skip duplicates or not. The default behavior is to skip duplicates. A duplicate message would have the Exchange propertyExchange.DUPLICATE_MESSAGE
set to aBoolean.TRUE
value. A none duplicate message will not have this property set.- Parameters:
skipDuplicate
- true to skip duplicates, false to allow duplicates.- Returns:
- builder
-
setExpression
public void setExpression(ExpressionDefinition expression)
Expression used to calculate the correlation key to use for duplicate check. The Exchange which has the same correlation key is regarded as a duplicate and will be rejected.- Overrides:
setExpression
in classExpressionNode
-
getMessageIdRepositoryRef
public String getMessageIdRepositoryRef()
-
setMessageIdRepositoryRef
public void setMessageIdRepositoryRef(String messageIdRepositoryRef)
-
getMessageIdRepository
public org.apache.camel.spi.IdempotentRepository getMessageIdRepository()
-
setMessageIdRepository
public void setMessageIdRepository(org.apache.camel.spi.IdempotentRepository idempotentRepository)
-
getEager
public String getEager()
-
setEager
public void setEager(String eager)
-
getSkipDuplicate
public String getSkipDuplicate()
-
setSkipDuplicate
public void setSkipDuplicate(String skipDuplicate)
-
getRemoveOnFailure
public String getRemoveOnFailure()
-
setRemoveOnFailure
public void setRemoveOnFailure(String removeOnFailure)
-
getCompletionEager
public String getCompletionEager()
-
setCompletionEager
public void setCompletionEager(String completionEager)
-
-