From 18d05361eed887f038c9b01b593dad56ea00ff1c Mon Sep 17 00:00:00 2001 From: Kai Moritz Date: Thu, 20 Apr 2023 22:11:51 +0200 Subject: [PATCH] NEU --- .../chat/backend/persistence/kafka/ChatMessageChannel.java | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatMessageChannel.java b/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatMessageChannel.java index 084986c8..ac30f1d3 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatMessageChannel.java +++ b/src/main/java/de/juplo/kafka/chat/backend/persistence/kafka/ChatMessageChannel.java @@ -60,6 +60,9 @@ public class ChatMessageChannel implements Runnable, ConsumerRebalanceListener this.currentOffset = new long[numShards]; this.nextOffset = new long[numShards]; this.chatrooms = new Map[numShards]; + IntStream + .range(0, numShards) + .forEach(shard -> this.chatrooms[shard] = new HashMap<>()); this.shardingStrategy = new KafkaLikeShardingStrategy(numShards); } -- 2.20.1