Class RuntimeConfiguration

java.lang.Object
com.bakdata.kafka.RuntimeConfiguration

public final class RuntimeConfiguration extends Object
Runtime configuration to connect to Kafka infrastructure, e.g., bootstrap servers and schema registry.
  • Method Details

    • create

      public static RuntimeConfiguration create(String bootstrapServers)
      Create a runtime configuration with the given bootstrap servers.
      Parameters:
      bootstrapServers - bootstrap servers to connect to
      Returns:
      runtime configuration
    • with

      public RuntimeConfiguration with(Map<String,?> newProperties)
      Configure arbitrary Kafka properties
      Parameters:
      newProperties - properties to configure
      Returns:
      a copy of this runtime configuration with provided properties
    • withSchemaRegistryUrl

      public RuntimeConfiguration withSchemaRegistryUrl(String schemaRegistryUrl)
      Configure a schema registry for (de-)serialization.
      Parameters:
      schemaRegistryUrl - schema registry url
      Returns:
      a copy of this runtime configuration with configured schema registry
    • withStateDir

      public RuntimeConfiguration withStateDir(Path stateDir)
      Configure StreamsConfig.STATE_DIR_CONFIG for Kafka Streams. Useful for testing
      Parameters:
      stateDir - directory to use for storing Kafka Streams state
      Returns:
      a copy of this runtime configuration with configured Kafka Streams state directory
    • withNoStateStoreCaching

      public RuntimeConfiguration withNoStateStoreCaching()
      Disable for Kafka Streams. Useful for testing
      Returns:
      a copy of this runtime configuration with Kafka Streams state store caching disabled
    • withSessionTimeout

      public RuntimeConfiguration withSessionTimeout(Duration sessionTimeout)
      Configure ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG for Kafka consumers. Useful for testing
      Parameters:
      sessionTimeout - session timeout
      Returns:
      a copy of this runtime configuration with configured consumer session timeout
    • createKafkaProperties

      public Map<String,Object> createKafkaProperties()
      Create Kafka properties to connect to infrastructure and modify runtime behavior. bootstrap.servers is always configured.
      Returns:
      properties used for connecting to Kafka