Interface ClusterInstance

All Known Implementing Classes:
RaftClusterInvocationContext.RaftClusterInstance

public interface ClusterInstance
  • Method Details

    • type

      org.apache.kafka.common.test.api.Type type()
    • brokers

      Map<Integer, kafka.server.KafkaBroker> brokers()
    • aliveBrokers

      default Map<Integer, kafka.server.KafkaBroker> aliveBrokers()
    • controllers

      Map<Integer, kafka.server.ControllerServer> controllers()
    • config

      org.apache.kafka.common.test.api.ClusterConfig config()
      The immutable cluster configuration used to create this cluster.
    • controllerIds

      Set<Integer> controllerIds()
      Return the set of all controller IDs configured for this test. For kraft, this will return only the nodes which have the "controller" role enabled in `process.roles`.
    • brokerIds

      default Set<Integer> brokerIds()
      Return the set of all broker IDs configured for this test.
    • clientListener

      org.apache.kafka.common.network.ListenerName clientListener()
      The listener for this cluster as configured by ClusterTest or by ClusterConfig. If unspecified by those sources, this will return the listener for the default security protocol PLAINTEXT
    • controllerListener

      org.apache.kafka.common.network.ListenerName controllerListener()
    • controllerListenerName

      org.apache.kafka.common.network.ListenerName controllerListenerName()
      The listener for the kraft cluster controller configured by controller.listener.names.
    • bootstrapServers

      String bootstrapServers()
      The broker connect string which can be used by clients for bootstrapping
    • bootstrapControllers

      String bootstrapControllers()
      The broker connect string which can be used by clients for bootstrapping to the controller quorum.
    • controllerBoundPorts

      default List<Integer> controllerBoundPorts()
    • brokerBoundPorts

      default List<Integer> brokerBoundPorts()
    • activeController

      kafka.network.SocketServer activeController() throws InterruptedException
      Throws:
      InterruptedException
    • linkCoordinator

      kafka.network.SocketServer linkCoordinator(String linkName)
    • clusterId

      String clusterId()
    • duplicateCluster

      ClusterInstance duplicateCluster(Consumer<org.apache.kafka.common.test.api.ClusterConfig.Builder> builderConsumer)
    • producer

      default <K,V> org.apache.kafka.clients.producer.Producer<K,V> producer(Map<String,Object> configs)
    • producer

      default <K,V> org.apache.kafka.clients.producer.Producer<K,V> producer()
    • consumer

      default <K,V> org.apache.kafka.clients.consumer.Consumer<K,V> consumer(Map<String,Object> configs)
    • consumer

      default <K,V> org.apache.kafka.clients.consumer.Consumer<K,V> consumer()
    • shareConsumer

      default <K,V> org.apache.kafka.clients.consumer.ShareConsumer<K,V> shareConsumer()
    • shareConsumer

      default <K,V> org.apache.kafka.clients.consumer.ShareConsumer<K,V> shareConsumer(Map<String,Object> configs)
    • shareConsumer

      default <K,V> org.apache.kafka.clients.consumer.ShareConsumer<K,V> shareConsumer(Map<String,Object> configs, org.apache.kafka.common.serialization.Deserializer<K> keyDeserializer, org.apache.kafka.common.serialization.Deserializer<V> valueDeserializer)
    • admin

      default org.apache.kafka.clients.admin.Admin admin(Map<String,Object> configs, boolean usingBootstrapControllers)
    • setClientSaslConfig

      default Map<String,Object> setClientSaslConfig(Map<String,Object> configs)
    • admin

      default org.apache.kafka.clients.admin.Admin admin(Map<String,Object> configs)
    • admin

      default org.apache.kafka.clients.admin.Admin admin()
    • supportedGroupProtocols

      default Set<org.apache.kafka.clients.consumer.GroupProtocol> supportedGroupProtocols()
    • firstFatalException

      Optional<org.apache.kafka.server.fault.FaultHandlerException> firstFatalException()
      Returns the first recorded fatal exception, if any.
    • firstNonFatalException

      Optional<org.apache.kafka.server.fault.FaultHandlerException> firstNonFatalException()
      Return the first recorded non-fatal exception, if any.
    • start

      void start()
    • started

      boolean started()
    • stop

      void stop()
    • stopped

      boolean stopped()
    • shutdownBroker

      void shutdownBroker(int brokerId)
    • startBroker

      void startBroker(int brokerId)
    • rollingBrokerRestart

      void rollingBrokerRestart()
    • killAllBrokers

      void killAllBrokers()
    • waitTopicDeletion

      default void waitTopicDeletion(String topic) throws InterruptedException
      Throws:
      InterruptedException
    • createTopic

      default void createTopic(String topicName, int partitions, short replicas) throws InterruptedException
      Throws:
      InterruptedException
    • createTopic

      default void createTopic(String topicName, int partitions, short replicas, Map<String,String> props) throws InterruptedException
      Throws:
      InterruptedException
    • deleteTopic

      default void deleteTopic(String topicName) throws InterruptedException, ExecutionException
      Deletes a topic and waits for the deletion to complete.
      Parameters:
      topicName - The name of the topic to delete
      Throws:
      InterruptedException - If the operation is interrupted
      ExecutionException
    • waitForReadyBrokers

      void waitForReadyBrokers() throws InterruptedException
      Throws:
      InterruptedException
    • brokersMap

      Map<Integer, kafka.server.KafkaBroker> brokersMap()
    • waitTopicCreation

      default void waitTopicCreation(String topic, int partitions) throws InterruptedException
      Throws:
      InterruptedException
    • ensureConsistentMetadata

      default void ensureConsistentMetadata() throws InterruptedException
      Throws:
      InterruptedException
    • ensureConsistentMetadata

      default void ensureConsistentMetadata(Collection<kafka.server.KafkaBroker> brokers, Collection<kafka.server.ControllerServer> controllers) throws InterruptedException
      Throws:
      InterruptedException
    • authorizers

      default List<org.apache.kafka.server.authorizer.Authorizer> authorizers()
    • waitAcls

      default void waitAcls(org.apache.kafka.common.acl.AclBindingFilter filter, Collection<org.apache.kafka.common.acl.AccessControlEntry> entries) throws InterruptedException
      Throws:
      InterruptedException
    • getLeaderBrokerId

      default int getLeaderBrokerId(org.apache.kafka.common.TopicPartition topicPartition) throws ExecutionException, InterruptedException
      Returns the broker id of leader partition.
      Throws:
      ExecutionException
      InterruptedException
    • waitUntilLeaderIsElectedOrChangedWithAdmin

      default int waitUntilLeaderIsElectedOrChangedWithAdmin(org.apache.kafka.clients.admin.Admin admin, String topic, int partitionNumber, long timeoutMs) throws Exception
      Wait for a leader to be elected or changed using the provided admin client.
      Throws:
      Exception