Upgrade Kafka client to v3.7.1
This change upgrades the Kafka client and introduces a breaking change. The contract in the
org.apache.kafka.clients.producer.Producer interface has been modified, specifically with the
removal of the following method:
- public void close(long timeout, TimeUnit unit)
Please review the release notes [1] and upgrade
documentation [2] for more details.
References:
[1] https://archive.apache.org/dist/kafka/3.7.1/RELEASE_NOTES.html
[2] https://kafka.apache.org/37/documentation.html#upgrade
Bug: Issue 323031722
Change-Id: I2de0724a2583da5005a8aa721229645b3e5b96f1
diff --git a/external_plugin_deps.bzl b/external_plugin_deps.bzl
index 0ae5935..b6b851b 100644
--- a/external_plugin_deps.bzl
+++ b/external_plugin_deps.bzl
@@ -3,8 +3,8 @@
def external_plugin_deps():
maven_jar(
name = "kafka-client",
- artifact = "org.apache.kafka:kafka-clients:2.8.2",
- sha1 = "b078c76ec2cf00803417c6505ebc8bef1a66d4db",
+ artifact = "org.apache.kafka:kafka-clients:3.7.1",
+ sha1 = "75a75c47eb912f3fd06df62a9e4b3b554d5b2bec",
)
maven_jar(
diff --git a/src/main/java/com/googlesource/gerrit/plugins/kafka/publish/KafkaRestProducer.java b/src/main/java/com/googlesource/gerrit/plugins/kafka/publish/KafkaRestProducer.java
index f418963..f9626bb 100644
--- a/src/main/java/com/googlesource/gerrit/plugins/kafka/publish/KafkaRestProducer.java
+++ b/src/main/java/com/googlesource/gerrit/plugins/kafka/publish/KafkaRestProducer.java
@@ -25,7 +25,6 @@
import java.util.List;
import java.util.Map;
import java.util.concurrent.Future;
-import java.util.concurrent.TimeUnit;
import org.apache.http.HttpStatus;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.ContentType;
@@ -40,6 +39,7 @@
import org.apache.kafka.common.MetricName;
import org.apache.kafka.common.PartitionInfo;
import org.apache.kafka.common.TopicPartition;
+import org.apache.kafka.common.Uuid;
import org.apache.kafka.common.errors.ProducerFencedException;
public class KafkaRestProducer implements Producer<String, String> {
@@ -131,13 +131,13 @@
}
@Override
- public void close(long timeout, TimeUnit unit) {
+ public void close(Duration timeout) {
close();
}
@Override
- public void close(Duration timeout) {
- close();
+ public Uuid clientInstanceId(Duration duration) {
+ return null;
}
private String getRecordAsJson(ProducerRecord<String, String> record) {