refactor: Pushed sharding one layer down in the architecture
[demos/kafka/chat] / src / main / java / de / juplo / kafka / chat / backend / ChatBackendApplication.java
index 8e1ff9e..c61f848 100644 (file)
@@ -16,7 +16,7 @@ public class ChatBackendApplication implements WebFluxConfigurer
        @Autowired
        ChatBackendProperties properties;
        @Autowired
-       ChatHome[] chatHomes;
+       ChatHome chatHome;
        @Autowired
        StorageStrategy storageStrategy;
 
@@ -32,8 +32,7 @@ public class ChatBackendApplication implements WebFluxConfigurer
        @PreDestroy
        public void onExit()
        {
-               for (int shard = 0; shard < chatHomes.length; shard++)
-                       storageStrategy.write(chatHomes[shard].getChatRooms());
+               storageStrategy.write(chatHome.getChatRooms());
        }
 
        public static void main(String[] args)