java.lang.Object
java.lang.Record
org.axonframework.messaging.eventhandling.processing.streaming.token.store.jpa.JpaTokenStoreConfiguration
Record Components:
loadingLockMode - The lock mode to use when retrieving tokens from the underlying store.
claimTimeout - A timeout specifying the time after which this process will force a claim.
nodeId - The id as a String to identify ownership of the tokens.

public record JpaTokenStoreConfiguration(@Nonnull jakarta.persistence.LockModeType loadingLockMode, @Nonnull TemporalAmount claimTimeout, @Nonnull String nodeId) extends Record
Configuration for the JpaTokenStore.

Can be used to modify the JpaTokenStore's settings.

Since:
5.0.0
Author:
Jens Mayer
  • Field Details

    • DEFAULT

      public static JpaTokenStoreConfiguration DEFAULT
      A JpaTokenStoreConfiguration instance with the following default values:
      • The loadingLockMode defaults to LockModeType.PESSIMISTIC_WRITE
      • The claimTimeout defaults to 10 seconds
      • The nodeId defaults to the name of the managed bean for the runtime system of the Java virtual machine
  • Constructor Details

    • JpaTokenStoreConfiguration

      public JpaTokenStoreConfiguration(@Nonnull jakarta.persistence.LockModeType loadingLockMode, @Nonnull TemporalAmount claimTimeout, @Nonnull String nodeId)
      Compact constructor validating that the given nodeId is non-empty and non-null.
  • Method Details

    • loadingLockMode

      public JpaTokenStoreConfiguration loadingLockMode(jakarta.persistence.LockModeType loadingLockMode)
      The LockModeType to use when loading tokens from the underlying database.

      Defaults to LockModeType.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 configuration itself, for fluent API usage.
    • claimTimeout

      public JpaTokenStoreConfiguration claimTimeout(TemporalAmount claimTimeout)
      Sets the claimTimeout specifying the amount of time a process will wait after which this process will force a claim of a TrackingToken.

      Thus, if a claim has not been updated for the given claimTimeout, 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 configuration itself, for fluent API usage.
    • nodeId

      public JpaTokenStoreConfiguration nodeId(String nodeId)
      Sets the nodeId to 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 a String to identify ownership of the tokens.
      Returns:
      The configuration itself, for fluent API usage.
    • toString

      public final String toString()
      Returns a string representation of this record class. The representation contains the name of the class, followed by the name and value of each of the record components.
      Specified by:
      toString in class Record
      Returns:
      a string representation of this object
    • hashCode

      public final int hashCode()
      Returns a hash code value for this object. The value is derived from the hash code of each of the record components.
      Specified by:
      hashCode in class Record
      Returns:
      a hash code value for this object
    • equals

      public final boolean equals(Object o)
      Indicates whether some other object is "equal to" this one. The objects are equal if the other object is of the same class and if all the record components are equal. All components in this record class are compared with Objects::equals(Object,Object).
      Specified by:
      equals in class Record
      Parameters:
      o - the object with which to compare
      Returns:
      true if this object is the same as the o argument; false otherwise.
    • loadingLockMode

      @Nonnull public jakarta.persistence.LockModeType loadingLockMode()
      Returns the value of the loadingLockMode record component.
      Returns:
      the value of the loadingLockMode record component
    • claimTimeout

      @Nonnull public TemporalAmount claimTimeout()
      Returns the value of the claimTimeout record component.
      Returns:
      the value of the claimTimeout record component
    • nodeId

      @Nonnull public String nodeId()
      Returns the value of the nodeId record component.
      Returns:
      the value of the nodeId record component