From: Kai Moritz Date: Sun, 28 Jan 2024 17:50:33 +0000 (+0100) Subject: fix: `metadata` is never `null` X-Git-Tag: rebase--2024-02-20--15-07~42 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=7fe01781a75e4694cd6dae1421c81d83886ef946;p=demos%2Fkafka%2Fchat fix: `metadata` is never `null` --- 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);