Skip to content

Commit c062c09

Browse files
authored
Upgrade to Kafka 3.8 (#267)
1 parent 677c5a6 commit c062c09

File tree

12 files changed

+45
-30
lines changed

12 files changed

+45
-30
lines changed

gradle.properties

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,12 @@ version=3.2.1-SNAPSHOT
22
org.gradle.caching=true
33
# running Kafka Streams in parallel causes problems with colliding consumer groups
44
org.gradle.parallel=false
5-
kafkaVersion=3.7.1
5+
kafkaVersion=3.8.1
66
testContainersVersion=1.20.4
7-
confluentVersion=7.7.0
8-
fluentKafkaVersion=2.15.0
9-
junitVersion=5.10.2
10-
mockitoVersion=5.11.0
11-
assertJVersion=3.25.3
12-
log4jVersion=2.23.1
7+
confluentVersion=7.8.0
8+
fluentKafkaVersion=2.16.0
9+
junitVersion=5.11.4
10+
mockitoVersion=5.15.2
11+
assertJVersion=3.27.2
12+
log4jVersion=2.24.3
1313
org.gradle.jvmargs=-Xmx4096m

streams-bootstrap-cli/build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ plugins {
66

77
dependencies {
88
api(project(":streams-bootstrap-core"))
9-
api(group = "info.picocli", name = "picocli", version = "4.7.5")
9+
api(group = "info.picocli", name = "picocli", version = "4.7.6")
1010

1111
val junitVersion: String by project
1212
testRuntimeOnly(group = "org.junit.jupiter", name = "junit-jupiter-engine", version = junitVersion)

streams-bootstrap-cli/src/test/java/com/bakdata/kafka/integration/StreamsCleanUpTest.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,7 +188,7 @@ private List<KeyValue<String, Long>> readOutputTopic(final String outputTopic) {
188188
.with(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, LongDeserializer.class)
189189
.from(outputTopic, TIMEOUT);
190190
return records.stream()
191-
.map(record -> new KeyValue<>(record.key(), record.value()))
191+
.map(consumerRecord -> new KeyValue<>(consumerRecord.key(), consumerRecord.value()))
192192
.collect(Collectors.toList());
193193
}
194194

@@ -213,7 +213,7 @@ private KafkaStreamsApplication<?> createWordCountApplication() {
213213
private <T extends KafkaStreamsApplication<?>> T configure(final T application) {
214214
application.setBootstrapServers(this.kafkaCluster.getBootstrapServers());
215215
application.setKafkaConfig(Map.of(
216-
StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, "0",
216+
StreamsConfig.STATESTORE_CACHE_MAX_BYTES_CONFIG, "0",
217217
ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, "10000"
218218
));
219219
return application;

streams-bootstrap-core/build.gradle.kts

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,18 @@ dependencies {
1313
val confluentVersion: String by project
1414
implementation(group = "io.confluent", name = "kafka-schema-serializer", version = confluentVersion)
1515
api(group = "io.confluent", name = "kafka-schema-registry-client", version = confluentVersion)
16-
api(
16+
implementation(
1717
group = "org.slf4j",
1818
name = "slf4j-api",
19-
version = "2.0.9"
20-
) // required because other dependencies use Slf4j 1.x which is not properly resolved if this library is used in test scope
21-
implementation(group = "org.jooq", name = "jool", version = "0.9.14")
19+
version = "2.0.16"
20+
)
21+
implementation(group = "org.jooq", name = "jool", version = "0.9.15")
2222

2323
val junitVersion: String by project
2424
testRuntimeOnly(group = "org.junit.jupiter", name = "junit-jupiter-engine", version = junitVersion)
2525
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-api", version = junitVersion)
2626
testImplementation(group = "org.junit.jupiter", name = "junit-jupiter-params", version = junitVersion)
27-
testImplementation(group = "org.junit-pioneer", name = "junit-pioneer", version = "2.2.0")
27+
testImplementation(group = "org.junit-pioneer", name = "junit-pioneer", version = "2.3.0")
2828
val assertJVersion: String by project
2929
testImplementation(group = "org.assertj", name = "assertj-core", version = assertJVersion)
3030
val mockitoVersion: String by project

streams-bootstrap-core/src/main/java/com/bakdata/kafka/util/ConsumerGroupClient.java

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,14 @@ public static ConsumerGroupClient create(final Map<String, Object> configs, fina
6060
return new ConsumerGroupClient(AdminClient.create(configs), timeout);
6161
}
6262

63+
private static KafkaAdminException failedToDeleteGroup(final String groupName, final Throwable ex) {
64+
return new KafkaAdminException("Failed to delete consumer group " + groupName, ex);
65+
}
66+
67+
private static KafkaAdminException failedToListGroups(final Throwable ex) {
68+
return new KafkaAdminException("Failed to list consumer groups", ex);
69+
}
70+
6371
/**
6472
* Delete a consumer group.
6573
*
@@ -74,14 +82,14 @@ public void deleteConsumerGroup(final String groupName) {
7482
log.info("Deleted consumer group '{}'", groupName);
7583
} catch (final InterruptedException ex) {
7684
Thread.currentThread().interrupt();
77-
throw new KafkaAdminException("Failed to delete consumer group " + groupName, ex);
85+
throw failedToDeleteGroup(groupName, ex);
7886
} catch (final ExecutionException ex) {
7987
if (ex.getCause() instanceof RuntimeException) {
8088
throw (RuntimeException) ex.getCause();
8189
}
82-
throw new KafkaAdminException("Failed to delete consumer group " + groupName, ex);
90+
throw failedToDeleteGroup(groupName, ex);
8391
} catch (final TimeoutException ex) {
84-
throw new KafkaAdminException("Failed to delete consumer group " + groupName, ex);
92+
throw failedToDeleteGroup(groupName, ex);
8593
}
8694
}
8795

@@ -115,14 +123,14 @@ public Collection<ConsumerGroupListing> listGroups() {
115123
.get(this.timeout.toSeconds(), TimeUnit.SECONDS);
116124
} catch (final InterruptedException ex) {
117125
Thread.currentThread().interrupt();
118-
throw new KafkaAdminException("Failed to list consumer groups", ex);
126+
throw failedToListGroups(ex);
119127
} catch (final ExecutionException ex) {
120128
if (ex.getCause() instanceof RuntimeException) {
121129
throw (RuntimeException) ex.getCause();
122130
}
123-
throw new KafkaAdminException("Failed to list consumer groups", ex);
131+
throw failedToListGroups(ex);
124132
} catch (final TimeoutException ex) {
125-
throw new KafkaAdminException("Failed to list consumer groups", ex);
133+
throw failedToListGroups(ex);
126134
}
127135
}
128136

streams-bootstrap-core/src/test/java/com/bakdata/kafka/integration/ProducerCleanUpRunnerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -176,7 +176,7 @@ private List<KeyValue<String, String>> readOutputTopic(final String outputTopic)
176176
final List<ConsumerRecord<String, String>> records =
177177
this.newContainerHelper().read().from(outputTopic, Duration.ofSeconds(1L));
178178
return records.stream()
179-
.map(record -> new org.apache.kafka.streams.KeyValue<>(record.key(), record.value()))
179+
.map(StreamsCleanUpRunnerTest::toKeyValue)
180180
.collect(Collectors.toList());
181181
}
182182

streams-bootstrap-core/src/test/java/com/bakdata/kafka/integration/ProducerRunnerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ private List<KeyValue<String, String>> readOutputTopic(final String outputTopic)
7474
final List<ConsumerRecord<String, String>> records =
7575
this.newContainerHelper().read().from(outputTopic, Duration.ofSeconds(1L));
7676
return records.stream()
77-
.map(record -> new KeyValue<>(record.key(), record.value()))
77+
.map(StreamsCleanUpRunnerTest::toKeyValue)
7878
.collect(Collectors.toList());
7979
}
8080

streams-bootstrap-core/src/test/java/com/bakdata/kafka/integration/StreamsCleanUpRunnerTest.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,10 @@ class StreamsCleanUpRunnerTest extends KafkaTest {
8888
@Mock
8989
private TopicHook topicHook;
9090

91+
static <K, V> KeyValue<K, V> toKeyValue(final ConsumerRecord<K, V> consumerRecord) {
92+
return new KeyValue<>(consumerRecord.key(), consumerRecord.value());
93+
}
94+
9195
private static ConfiguredStreamsApp<StreamsApp> createWordCountPatternApplication() {
9296
return configureApp(new WordCountPattern(), StreamsTopicConfig.builder()
9397
.inputPattern(Pattern.compile(".*_topic"))
@@ -547,7 +551,6 @@ void shouldDeleteSchemaOfInternalTopics()
547551
}
548552
}
549553

550-
551554
@Test
552555
void shouldDeleteSchemaOfIntermediateTopics()
553556
throws InterruptedException, IOException, RestClientException {
@@ -717,7 +720,7 @@ private List<KeyValue<String, Long>> readOutputTopic(final String outputTopic) {
717720
.with(ConsumerConfig.VALUE_DESERIALIZER_CLASS_CONFIG, LongDeserializer.class)
718721
.from(outputTopic, TIMEOUT);
719722
return records.stream()
720-
.map(record -> new KeyValue<>(record.key(), record.value()))
723+
.map(StreamsCleanUpRunnerTest::toKeyValue)
721724
.collect(Collectors.toList());
722725
}
723726

streams-bootstrap-core/src/test/java/com/bakdata/kafka/integration/StreamsRunnerTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ static Thread run(final StreamsRunner runner) {
9494

9595
static ConfiguredStreamsApp<StreamsApp> configureApp(final StreamsApp app, final StreamsTopicConfig topics) {
9696
final AppConfiguration<StreamsTopicConfig> configuration = new AppConfiguration<>(topics, Map.of(
97-
StreamsConfig.CACHE_MAX_BYTES_BUFFERING_CONFIG, "0",
97+
StreamsConfig.STATESTORE_CACHE_MAX_BYTES_CONFIG, "0",
9898
ConsumerConfig.SESSION_TIMEOUT_MS_CONFIG, "10000"
9999
));
100100
return new ConfiguredStreamsApp<>(app, configuration);

streams-bootstrap-core/src/testFixtures/java/com/bakdata/kafka/TestUtil.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,6 @@
3131
@UtilityClass
3232
public class TestUtil {
3333
public static KafkaContainer newKafkaCluster() {
34-
return new KafkaContainer(DockerImageName.parse("apache/kafka:3.7.1"));
34+
return new KafkaContainer(DockerImageName.parse("apache/kafka-native:3.8.1"));
3535
}
3636
}

0 commit comments

Comments
 (0)