Skip to content

Commit

Permalink
chore: update kafka to 3.4 (#210)
Browse files Browse the repository at this point in the history
* chore: update kafka to 3.4

* chore: clean comments and nits
  • Loading branch information
jeqo authored Apr 17, 2023
1 parent a876d2e commit cb33037
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 10 deletions.
4 changes: 2 additions & 2 deletions kafka/pom.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
Copyright 2016-2021 The OpenZipkin Authors
Copyright 2016-2023 The OpenZipkin Authors
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
in compliance with the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -49,7 +49,7 @@
<groupId>org.apache.kafka</groupId>
<artifactId>kafka-clients</artifactId>
<!-- recent clients can talk to old 0.10 brokers -->
<version>2.7.0</version>
<version>3.4.0</version>
</dependency>

<dependency>
Expand Down
15 changes: 7 additions & 8 deletions kafka/src/main/java/zipkin2/reporter/kafka/KafkaSender.java
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright 2016-2020 The OpenZipkin Authors
* Copyright 2016-2023 The OpenZipkin Authors
*
* Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
* in compliance with the License. You may obtain a copy of the License at
Expand Down Expand Up @@ -142,7 +142,7 @@ public Builder messageMaxBytes(int messageMaxBytes) {
* By default, a producer will be created, targeted to {@link #bootstrapServers(String)} with 0
* required {@link ProducerConfig#ACKS_CONFIG acks}. Any properties set here will affect the
* producer config.
*
* <p>
* Consider not overriding batching properties ("batch.size" and "linger.ms") as those will
* duplicate buffering effort that is already handled by Sender.
*
Expand All @@ -155,7 +155,7 @@ public Builder messageMaxBytes(int messageMaxBytes) {
*
* @see ProducerConfig
*/
public final Builder overrides(Map<String, ?> overrides) {
public Builder overrides(Map<String, ?> overrides) {
if (overrides == null) throw new NullPointerException("overrides == null");
properties.putAll(overrides);
return this;
Expand All @@ -165,7 +165,7 @@ public final Builder overrides(Map<String, ?> overrides) {
* By default, a producer will be created, targeted to {@link #bootstrapServers(String)} with 0
* required {@link ProducerConfig#ACKS_CONFIG acks}. Any properties set here will affect the
* producer config.
*
* <p>
* Consider not overriding batching properties ("batch.size" and "linger.ms") as those will
* duplicate buffering effort that is already handled by Sender.
*
Expand Down Expand Up @@ -223,8 +223,8 @@ public KafkaSender build() {
*/
Map<String, Object> filterPropertiesForAdminClient(Properties properties) {
Map<String, Object> adminClientProperties = new LinkedHashMap<>();
for (Map.Entry property : properties.entrySet()) {
if (AdminClientConfig.configNames().contains(property.getKey())) {
for (Map.Entry<?, ?> property : properties.entrySet()) {
if (AdminClientConfig.configNames().contains((String) property.getKey())) {
adminClientProperties.put(property.getKey().toString(), property.getValue());
}
}
Expand Down Expand Up @@ -305,8 +305,7 @@ AdminClient getAdminClient() {
KafkaProducer<byte[], byte[]> producer = this.producer;
if (producer != null) producer.close();
AdminClient adminClient = this.adminClient;
// Intentionally using deprecated method to avoid pinning newer Kafka client
if (adminClient != null) adminClient.close(1, TimeUnit.SECONDS);
if (adminClient != null) adminClient.close();
closeCalled = true;
}

Expand Down

0 comments on commit cb33037

Please sign in to comment.