Package io.strimzi.test.container
Class StrimziKafkaCluster
java.lang.Object
io.strimzi.test.container.StrimziKafkaCluster
- All Implemented Interfaces:
KafkaContainer,AutoCloseable,org.testcontainers.lifecycle.Startable
A multi-node instance of Kafka using the latest image from quay.io/strimzi/kafka with the given version.
It perfectly fits for integration/system testing.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classBuilder class forStrimziKafkaCluster. -
Method Summary
Modifier and TypeMethodDescriptionGet the bootstrap controllers that can be used for controller operationsGet the Kafka cluster bootstrap servers.Returns the broker nodes.Returns the controller nodes.Get the bootstrap controllers that containers on the same network should use to connect to controllersGet the bootstrap servers that containers on the same network should use to connectCollection<org.testcontainers.containers.GenericContainer<?>>getNodes()Returns the underlying GenericContainer instances for all Kafka nodes in the cluster.booleanChecks if the cluster is using dedicated controller/broker roles.voidstart()voidstop()Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface org.testcontainers.lifecycle.Startable
close, getDependencies
-
Method Details
-
getNodes
Returns the underlying GenericContainer instances for all Kafka nodes in the cluster. In the current setup, all nodes are combined-role (i.e., each acts as both broker and controller) in KRaft mode.- Returns:
- Collection of GenericContainer representing the cluster nodes
-
getNetworkBootstrapServers
Get the bootstrap servers that containers on the same network should use to connect- Returns:
- a comma separated list of Kafka bootstrap servers
-
getBootstrapServers
Description copied from interface:KafkaContainerGet the Kafka cluster bootstrap servers.- Specified by:
getBootstrapServersin interfaceKafkaContainer- Returns:
- bootstrap servers
-
getBootstrapControllers
Get the bootstrap controllers that can be used for controller operations- Specified by:
getBootstrapControllersin interfaceKafkaContainer- Returns:
- a comma separated list of Kafka controller endpoints
-
getNetworkBootstrapControllers
Get the bootstrap controllers that containers on the same network should use to connect to controllers- Returns:
- a comma separated list of Kafka controller endpoints
-
start
public void start()- Specified by:
startin interfaceorg.testcontainers.lifecycle.Startable
-
stop
public void stop()- Specified by:
stopin interfaceorg.testcontainers.lifecycle.Startable
-
getControllers
Returns the controller nodes. For combined-role clusters, this returns all nodes. For dedicated-role clusters, this returns only the controller-only nodes.- Returns:
- Collection of controller nodes
-
getBrokers
Returns the broker nodes. For combined-role clusters, this returns all nodes. For dedicated-role clusters, this returns only the broker-only nodes. Keep the method name getBrokers() to preserve backwards compatibility.- Returns:
- Collection of broker nodes
-
isUsingDedicatedRoles
public boolean isUsingDedicatedRoles()Checks if the cluster is using dedicated controller/broker roles.- Returns:
- true if using dedicated roles, false if using combined roles
-