From: Kai Moritz Date: Fri, 15 Mar 2024 15:22:14 +0000 (+0100) Subject: WIP:fix:activation X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=89b5eb1eaf7890c830848dbc4281add2bff41131;p=demos%2Fkafka%2Fchat WIP:fix:activation --- 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 42f17d14..abe51f4a 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 @@ -341,9 +341,17 @@ public class DataChannel implements Channel, ConsumerRebalanceListener void createChatRoomData(ChatRoomInfo chatRoomInfo) { - computeChatRoomData( + int shard = chatRoomInfo.getShard(); + + ChatRoomData chatRoomData = computeChatRoomData( chatRoomInfo.getId(), chatRoomInfo.getShard()); + + // TODO: Possible race-condition in case of an ongoing rebalance! + if (isShardOwned[shard]) + { + chatRoomData.activate(); + } } Mono getChatRoomData(int shard, UUID id)