From f31223d5f2b094d38ea28c0054c0f1f38b72dd2c Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Sun, 28 Jan 2024 18:50:33 +0100 Subject: [PATCH] fix: `metadata` is never `null` --- .../kafka/chat/backend/implementation/kafka/DataChannel.java | 2 +- .../kafka/chat/backend/implementation/kafka/InfoChannel.java | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/DataChannel.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/DataChannel.java index da906631..381152b5 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/DataChannel.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/DataChannel.java @@ -96,7 +96,7 @@ public class DataChannel implements Runnable, ConsumerRebalanceListener producer.send(record, ((metadata, exception) -> { - if (metadata != null) + if (exception == null) { // On successful send Message message = new Message(key, metadata.offset(), timestamp, text); diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/InfoChannel.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/InfoChannel.java index 26e86963..1d9d8016 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/InfoChannel.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/InfoChannel.java @@ -81,7 +81,7 @@ public class InfoChannel implements Runnable producer.send(record, ((metadata, exception) -> { - if (metadata != null) + if (exception == null) { log.info("Successfully sent chreate-request for chat room: {}", to); ChatRoomInfo chatRoomInfo = new ChatRoomInfo(chatRoomId, name, shard); -- 2.20.1