Class JpaTokenStore.Builder
java.lang.Object
org.axonframework.eventhandling.tokenstore.jpa.JpaTokenStore.Builder
- Enclosing class:
JpaTokenStore
Builder class to instantiate a
JpaTokenStore.
The claimTimeout to a 10 seconds duration, and nodeId is defaulted to the name of the managed
bean for the runtime system of the Java virtual machine. The EntityManagerProvider and Serializer
are a hard requirements and as such should be provided.
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbuild()Initializes aJpaTokenStoreas specified through this Builder.claimTimeout(TemporalAmount claimTimeout) Sets theclaimTimeoutspecifying the amount of time this process will wait after which this process will force a claim of aTrackingToken.entityManagerProvider(EntityManagerProvider entityManagerProvider) Sets theEntityManagerProviderwhich provides theEntityManagerused to access the underlying database.loadingLockMode(jakarta.persistence.LockModeType loadingLockMode) TheLockModeTypeto use when loading tokens from the underlying database.Sets thenodeIdto identify ownership of the tokens.serializer(Serializer serializer) Sets theSerializerused to de-/serializeTrackingTokens with.protected voidvalidate()Validates whether the fields contained in this Builder are set accordingly.
-
Constructor Details
-
Builder
public Builder()
-
-
Method Details
-
entityManagerProvider
Sets theEntityManagerProviderwhich provides theEntityManagerused to access the underlying database.- Parameters:
entityManagerProvider- aEntityManagerProviderwhich provides theEntityManagerused to access the underlying database- Returns:
- the current Builder instance, for fluent interfacing
-
serializer
Sets theSerializerused to de-/serializeTrackingTokens with.- Parameters:
serializer- aSerializerused to de-/serializeTrackingTokens with- Returns:
- the current Builder instance, for fluent interfacing
-
claimTimeout
Sets theclaimTimeoutspecifying the amount of time this process will wait after which this process will force a claim of aTrackingToken. Thus if a claim has not been updated for the givenclaimTimeout, this process will 'steal' the claim. Defaults to a duration of 10 seconds.- Parameters:
claimTimeout- a timeout specifying the time after which this process will force a claim- Returns:
- the current Builder instance, for fluent interfacing
-
nodeId
Sets thenodeIdto identify ownership of the tokens. Defaults to the name of the managed bean for the runtime system of the Java virtual machine- Parameters:
nodeId- the id as aStringto identify ownership of the tokens- Returns:
- the current Builder instance, for fluent interfacing
-
loadingLockMode
TheLockModeTypeto use when loading tokens from the underlying database. Defaults toLockModeType.PESSIMISTIC_WRITE, to force a write lock, which prevents lock upgrading and potential resulting deadlocks.- Parameters:
loadingLockMode- The lock mode to use when retrieving tokens from the underlying store- Returns:
- the current Builder instance, for fluent interfacing
-
build
Initializes aJpaTokenStoreas specified through this Builder.- Returns:
- a
JpaTokenStoreas specified through this Builder
-
validate
Validates whether the fields contained in this Builder are set accordingly.- Throws:
AxonConfigurationException- if one field is asserted to be incorrect according to the Builder's specifications
-