From e6ce90009813297a4231ab643feaa1cbd72c9e98 Mon Sep 17 00:00:00 2001 From: dpcollins-google <40498610+dpcollins-google@users.noreply.github.com> Date: Mon, 23 Jan 2023 16:28:25 -0500 Subject: [PATCH] fix: set max.in.flight.requests.per.connection to 1 This preserves order when enable.idempotency is false --- .../com/google/cloud/pubsublite/kafka/ClientParameters.java | 2 ++ 1 file changed, 2 insertions(+) diff --git a/pubsublite-kafka-auth/src/main/java/com/google/cloud/pubsublite/kafka/ClientParameters.java b/pubsublite-kafka-auth/src/main/java/com/google/cloud/pubsublite/kafka/ClientParameters.java index 1f3cbf44..99472760 100644 --- a/pubsublite-kafka-auth/src/main/java/com/google/cloud/pubsublite/kafka/ClientParameters.java +++ b/pubsublite-kafka-auth/src/main/java/com/google/cloud/pubsublite/kafka/ClientParameters.java @@ -38,6 +38,8 @@ public static Map getProducerParams( ProjectIdOrNumber project, CloudRegion region) { HashMap params = new HashMap<>(); params.put("enable.idempotence", false); + // While ENABLE_IDEMPOTENCE_CONFIG is false, this must be 1 to preserver ordering. + params.put("max.in.flight.requests.per.connection", 1); params.put("bootstrap.servers", getEndpoint(region)); params.put("security.protocol", "SASL_SSL"); params.put("sasl.mechanism", "OAUTHBEARER");