Skip to content

Replace confluentinc/cp-kafka with apache/kafka-native #568

Description

@helpermethod

What problem are you trying to solve?

  • replace org.testcontainers.container.KafkaContainer with the new implementation org.testcontainers.kafka.KafkaContainer
  • replace the Confluent Kafka Image with the much faster Apache Kafka Native Image

What precondition(s) should be checked before applying this recipe?

Requires Testcontainers 1.20.1

Describe the situation before applying the recipe

import org.testcontainers.containers.KafkaContainer;

@TestContainers
class KafkaTests {
    @Container
    KafkaContainer kafka = new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka:7.5.3"));
}

Describe the situation after applying the recipe

import org.testcontainers.kafka.KafkaContainer;

@TestContainers
class KafkaTests {
    @Container
    KafkaContainer kafka = new KafkaContainer(DockerImageName.parse("apache/kafka-native:3.8.0"));
}

Have you considered any alternatives or workarounds?

No.

Any additional context

Docker image versions don't map 1:1.

Are you interested in contributing this recipe to OpenRewrite?

Yes!

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions