Class JdbcTokenStore.Builder

java.lang.Object
org.axonframework.eventhandling.tokenstore.jdbc.JdbcTokenStore.Builder
Enclosing class:
JdbcTokenStore

public static class JdbcTokenStore.Builder extends Object
Builder class to instantiate a JdbcTokenStore.

The schema is defaulted to an TokenSchema, the claimTimeout to a 10 seconds duration, nodeId is defaulted to the name of the managed bean for the runtime system of the Java virtual machine and the contentType to a byte[] Class. The ConnectionProvider and Serializer are hard requirements and as such should be provided.

  • Constructor Details

    • Builder

      public Builder()
  • Method Details

    • connectionProvider

      public JdbcTokenStore.Builder connectionProvider(ConnectionProvider connectionProvider)
      Sets the ConnectionProvider used to provide connections to the underlying database.
      Parameters:
      connectionProvider - a ConnectionProvider used to provide connections to the underlying database
      Returns:
      the current Builder instance, for fluent interfacing
    • serializer

      public JdbcTokenStore.Builder serializer(Serializer serializer)
      Sets the Serializer used to de-/serialize TrackingTokens with.
      Parameters:
      serializer - a Serializer used to de-/serialize TrackingTokens with
      Returns:
      the current Builder instance, for fluent interfacing
    • schema

      public JdbcTokenStore.Builder schema(TokenSchema schema)
      Sets the schema which describes a JDBC token entry for this TokenStore. Defaults to a default TokenSchema instance.
      Parameters:
      schema - a TokenSchema which describes a JDBC token entry for this TokenStore
      Returns:
      the current Builder instance, for fluent interfacing
    • claimTimeout

      public JdbcTokenStore.Builder claimTimeout(TemporalAmount claimTimeout)
      Sets the claimTimeout specifying the amount of time this 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 current Builder instance, for fluent interfacing
    • nodeId

      public JdbcTokenStore.Builder 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 current Builder instance, for fluent interfacing
    • contentType

      public JdbcTokenStore.Builder contentType(Class<?> contentType)
      Sets the contentType to which a TrackingToken should be serialized. Defaults to a byte[] Class type.
      Parameters:
      contentType - the content type as a Classto which a TrackingToken should be serialized
      Returns:
      the current Builder instance, for fluent interfacing
    • build

      public JdbcTokenStore build()
      Initializes a JdbcTokenStore as specified through this Builder.
      Returns:
      a JdbcTokenStore as specified through this Builder
    • validate

      protected void validate() throws AxonConfigurationException
      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