Skip to content

Commit

Permalink
feat : migrate to use official apache kafka image
Browse files Browse the repository at this point in the history
  • Loading branch information
rajadilipkolli committed Jun 26, 2024
1 parent ecac74f commit 4c63b48
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ Licensed under MIT License Copyright (c) 2023-2024 Raja Kolli.
import org.springframework.context.annotation.Bean;
import org.springframework.test.context.DynamicPropertyRegistry;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.kafka.KafkaContainer;
import org.testcontainers.utility.DockerImageName;

@TestConfiguration(proxyBeanMethods = false)
Expand All @@ -37,8 +37,7 @@ PostgreSQLContainer<?> postgreSqlContainer() {
@ServiceConnection
KafkaContainer kafkaContainer(DynamicPropertyRegistry dynamicPropertyRegistry) {
KafkaContainer kafkaContainer =
new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka").withTag("7.6.0"))
.withKraft()
new KafkaContainer(DockerImageName.parse("apache/kafka").withTag("3.7.0"))
.withReuse(true);
dynamicPropertyRegistry.add(
"spring.cloud.stream.kafka.binder.brokers", kafkaContainer::getBootstrapServers);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Licensed under MIT License Copyright (c) 2023-2024 Raja Kolli.
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Import;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.kafka.KafkaContainer;
import org.testcontainers.utility.DockerImageName;

@TestConfiguration(proxyBeanMethods = false)
Expand All @@ -31,8 +31,7 @@ GenericContainer<?> zipkContainer() {
@Bean
@ServiceConnection
KafkaContainer kafkaContainer() {
return new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka").withTag("7.6.0"))
.withKraft()
return new KafkaContainer(DockerImageName.parse("apache/kafka").withTag("3.7.0"))
.withReuse(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Licensed under MIT License Copyright (c) 2023-2024 Raja Kolli.
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.kafka.KafkaContainer;
import org.testcontainers.utility.DockerImageName;

@TestConfiguration(proxyBeanMethods = false)
Expand All @@ -26,8 +26,7 @@ public class TestOrderServiceApplication {
@ServiceConnection
@RestartScope
KafkaContainer kafkaContainer() {
return new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka").withTag("7.6.0"))
.withKraft()
return new KafkaContainer(DockerImageName.parse("apache/kafka").withTag("3.7.0"))
.withReuse(true);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import org.springframework.boot.testcontainers.service.connection.ServiceConnection;
import org.springframework.context.annotation.Bean;
import org.testcontainers.containers.GenericContainer;
import org.testcontainers.containers.KafkaContainer;
import org.testcontainers.containers.PostgreSQLContainer;
import org.testcontainers.kafka.KafkaContainer;
import org.testcontainers.utility.DockerImageName;

@TestConfiguration(proxyBeanMethods = false)
Expand All @@ -31,8 +31,7 @@ GenericContainer<?> zipkContainer() {
@Bean
@ServiceConnection
KafkaContainer kafkaContainer() {
return new KafkaContainer(DockerImageName.parse("confluentinc/cp-kafka").withTag("7.6.0"))
.withKraft()
return new KafkaContainer(DockerImageName.parse("apache/kafka").withTag("3.7.0"))
.withReuse(true);
}

Expand Down

0 comments on commit 4c63b48

Please sign in to comment.