WIP:fix:activation backend-handover-it
authorKai Moritz <kai@juplo.de>
Fri, 15 Mar 2024 15:22:14 +0000 (16:22 +0100)
committerKai Moritz <kai@juplo.de>
Sat, 16 Mar 2024 09:45:41 +0000 (10:45 +0100)
src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/DataChannel.java

index 42f17d1..abe51f4 100644 (file)
@@ -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<ChatRoomData> getChatRoomData(int shard, UUID id)