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

      default Optional<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.
    • brokerSocketServers

      default Collection<kafka.network.SocketServer> brokerSocketServers()
      A collection of all brokers in the cluster.
    • controllerSocketServers

      Collection<kafka.network.SocketServer> controllerSocketServers()
      A collection of all controllers in the cluster.
    • anyBrokerSocketServer

      default kafka.network.SocketServer anyBrokerSocketServer()
      Return any one of the broker servers. Throw an error if none are found
    • anyNonControllerBrokerSocketServer

      kafka.network.SocketServer anyNonControllerBrokerSocketServer()
    • anyControllerSocketServer

      default kafka.network.SocketServer anyControllerSocketServer()
      Return any one of the controller servers. Throw an error if none are found
    • 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)
    • 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()
    • stop

      void stop()
    • 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
    • waitForReadyBrokers

      void waitForReadyBrokers() throws InterruptedException
      Throws:
      InterruptedException
    • brokersMap

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

      default void waitForTopic(String topic, int partitions) 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