Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions docs/modules/kafka.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,16 @@ The following field in your JUnit test class will prepare a container running Ka
<!--codeinclude-->
[JUnit Rule](../../modules/kafka/src/test/java/org/testcontainers/containers/KafkaContainerTest.java) inside_block:junitRule
<!--/codeinclude-->


The correspondence between Confluent Platform versions and Kafka versions can be seen [in Confluent documentation](https://docs.confluent.io/current/installation/versions-interoperability.html#cp-and-apache-kafka-compatibility)

Now your tests or any other process running on your machine can get access to running Kafka broker by using the following bootstrap server location:

<!--codeinclude-->
[Bootstrap Servers](../../modules/kafka/src/test/java/org/testcontainers/containers/KafkaContainerTest.java) inside_block:getBootstrapServers
<!--/codeinclude-->


## Options

### Selecting Kafka version

You can select a specific Confluent Platform Kafka docker image by passing it to the container's constructor:
<!--codeinclude-->
[Version Constructor](../../modules/kafka/src/test/java/org/testcontainers/containers/KafkaContainerTest.java) inside_block:constructorWithVersion
<!--/codeinclude-->


The correspondence between Confluent Platform versions and Kafka versions can be seen [in Confluent documentation](https://docs.confluent.io/current/installation/versions-interoperability.html#cp-and-apache-kafka-compatibility)

### <a name="zookeeper"></a> Using external Zookeeper

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
public class KafkaContainer extends GenericContainer<KafkaContainer> {

private static final DockerImageName DEFAULT_IMAGE_NAME = DockerImageName.parse("confluentinc/cp-kafka");
private static final String DEFAULT_TAG = "5.2.1";
private static final String DEFAULT_TAG = "5.4.3";

private static final String STARTER_SCRIPT = "/testcontainers_start.sh";

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@

public class KafkaContainerTest {

private static final DockerImageName KAFKA_TEST_IMAGE = DockerImageName.parse("confluentinc/cp-kafka:5.2.1");
private static final DockerImageName KAFKA_TEST_IMAGE = DockerImageName.parse("confluentinc/cp-kafka:5.4.3");
private static final DockerImageName ZOOKEEPER_TEST_IMAGE = DockerImageName.parse("confluentinc/cp-zookeeper:4.0.0");

// junitRule {
@ClassRule
public static KafkaContainer kafka = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:5.2.1"));
public static KafkaContainer kafka = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:5.4.3"));
// }

@Test
Expand All @@ -45,7 +45,7 @@ public void testUsage() throws Exception {
public void testUsageWithSpecificImage() throws Exception {
try (
// constructorWithVersion {
KafkaContainer kafka = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:5.2.1"))
KafkaContainer kafka = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:5.4.3"))
// }
) {
kafka.start();
Expand All @@ -61,7 +61,7 @@ public void testUsageWithSpecificImage() throws Exception {
@Test
public void testUsageWithVersion() throws Exception {
try (
KafkaContainer kafka = new KafkaContainer("5.2.1")
KafkaContainer kafka = new KafkaContainer("5.4.3")
) {
kafka.start();
testKafkaFunctionality(kafka.getBootstrapServers());
Expand Down