Class KafkaClusterConfig

java.lang.Object
io.kroxylicious.testing.kafka.common.KafkaClusterConfig

public class KafkaClusterConfig extends Object
The Kafka cluster config class.
  • Constructor Details

    • KafkaClusterConfig

      public KafkaClusterConfig()
  • Method Details

    • supportsConstraint

      public static boolean supportsConstraint(Class<? extends Annotation> annotation)
      Does the KafkaClusterConfiguration support the supplied constraint.
      Parameters:
      annotation - the annotation
      Returns:
      the boolean
    • fromConstraints

      public static KafkaClusterConfig fromConstraints(List<Annotation> annotations, TestInfo testInfo)
      Build the cluster constraints from the supplied list of annotations.
      Parameters:
      annotations - the annotations used to configure the KafkaCluster
      testInfo - information about the test execution context.
      Returns:
      the kafka cluster config
    • getBrokerConfigs

      public Stream<KafkaClusterConfig.ConfigHolder> getBrokerConfigs(Supplier<KafkaListenerSource> listenerSourceSupplier)
      Gets broker configs.
      Parameters:
      listenerSourceSupplier - the end point config supplier
      Returns:
      the broker configs
    • generateConfigForSpecificNode

      @NonNull public KafkaClusterConfig.ConfigHolder generateConfigForSpecificNode(KafkaListenerSource kafkaListenerSource, int nodeId)
      Get a broker configs for a specific node.id.
      Parameters:
      kafkaListenerSource - the end point config
      nodeId - kafka node.id
      Returns:
      broker configuration.
    • getAnonConnectConfigForCluster

      public Map<String,Object> getAnonConnectConfigForCluster(String bootstrapServers)
      Generates client connection config to connect to the anonymous listeners within the cluster. Thus bypassing all authentication mechanisms.
      Parameters:
      bootstrapServers - the bootstrap servers
      Returns:
      the anon connect config for cluster
    • getConnectConfigForCluster

      public Map<String,Object> getConnectConfigForCluster(String bootstrapServers)
      Generates client connection config to connect to the cluster via the supplied bootstrap address.
      Parameters:
      bootstrapServers - the bootstrap servers
      Returns:
      the connect config for cluster
    • getConnectConfigForCluster

      public Map<String,Object> getConnectConfigForCluster(String bootstrapServers, String user, String password)
      Generates client connection config to connect to the cluster via the supplied bootstrap address and user credentials.
      Parameters:
      bootstrapServers - the bootstrap servers
      user - the user
      password - the password
      Returns:
      the connect config for cluster
    • getConnectConfigForCluster

      public Map<String,Object> getConnectConfigForCluster(String bootstrapServers, String user, String password, String securityProtocol, String saslMechanism)
      Generates client connection config to connect to the cluster via the supplied bootstrap address and authentication configuration.
      Parameters:
      bootstrapServers - the bootstrap servers
      user - the user
      password - the password
      securityProtocol - the security protocol
      saslMechanism - the sasl mechanism
      Returns:
      the connect config for cluster
    • getControllerAdminClientConfigForCluster

      public Map<String,Object> getControllerAdminClientConfigForCluster(String bootstrapControllers)
      Generates client connection config to connect to the cluster via the supplied controller bootstrap address. This method is applicable to KRaft clusters only.
      Parameters:
      bootstrapControllers - controller bootstrap
      Returns:
      the connect config for cluster
    • isSaslScram

      public boolean isSaslScram()
    • getScramMechanism

      public Optional<org.apache.kafka.clients.admin.ScramMechanism> getScramMechanism()
    • isKraftMode

      public boolean isKraftMode()
      Is the cluster coppering using Kraft Controller nodes.
      Returns:
      true if kraft mode is used, false otherwise
    • clusterId

      public String clusterId()
      Cluster id string.
      Returns:
      the id
    • isKafkaVersion41OrHigher

      public boolean isKafkaVersion41OrHigher()