Package org.apache.camel.spi
Interface IdempotentRepository
-
- All Superinterfaces:
AutoCloseable,Service
public interface IdempotentRepository extends Service
Access to a repository of Message IDs to implement the Idempotent Consumer pattern. The add and contains methods is operating according to theSetcontract. The repository supports eager (default) and non-eager mode.- eager: calls add and confirm if complete, or remove if failed
- non-eager: calls contains and add if complete, or remove if failed
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description booleanadd(String key)Adds the key to the repository.default booleanadd(Exchange exchange, String key)Adds the key to the repository.voidclear()Clear the repository.booleanconfirm(String key)Confirms the key, after the exchange has been processed successfully.default booleanconfirm(Exchange exchange, String key)Confirms the key, after the exchange has been processed successfully.booleancontains(String key)Returns true if this repository contains the specified element.default booleancontains(Exchange exchange, String key)Returns true if this repository contains the specified element.booleanremove(String key)Removes the key from the repository.default booleanremove(Exchange exchange, String key)Removes the key from the repository.
-
-
-
Method Detail
-
add
boolean add(String key)
Adds the key to the repository. Important: Read the class javadoc about eager vs non-eager mode.- Parameters:
key- the key of the message for duplicate test- Returns:
- true if this repository did not already contain the specified element
-
contains
boolean contains(String key)
Returns true if this repository contains the specified element. Important: Read the class javadoc about eager vs non-eager mode.- Parameters:
key- the key of the message- Returns:
- true if this repository contains the specified element
-
remove
boolean remove(String key)
Removes the key from the repository. Is usually invoked if the exchange failed. Important: Read the class javadoc about eager vs non-eager mode.- Parameters:
key- the key of the message for duplicate test- Returns:
- true if the key was removed
-
confirm
boolean confirm(String key)
Confirms the key, after the exchange has been processed successfully. Important: Read the class javadoc about eager vs non-eager mode.- Parameters:
key- the key of the message for duplicate test- Returns:
- true if the key was confirmed
-
clear
void clear()
Clear the repository. Important: Read the class javadoc about eager vs non-eager mode.
-
add
default boolean add(Exchange exchange, String key)
Adds the key to the repository. Important: Read the class javadoc about eager vs non-eager mode.- Parameters:
key- the key of the message for duplicate test- Returns:
- true if this repository did not already contain the specified element
-
contains
default boolean contains(Exchange exchange, String key)
Returns true if this repository contains the specified element. Important: Read the class javadoc about eager vs non-eager mode.- Parameters:
key- the key of the message- Returns:
- true if this repository contains the specified element
-
remove
default boolean remove(Exchange exchange, String key)
Removes the key from the repository. Is usually invoked if the exchange failed. Important: Read the class javadoc about eager vs non-eager mode.- Parameters:
key- the key of the message for duplicate test- Returns:
- true if the key was removed
-
-