feat: The position of the last seen messages is stored on a revoke
[demos/kafka/chat] / src / main / java / de / juplo / kafka / chat / backend / ChatBackendApplication.java
index dbd12b0..1eaa88c 100644 (file)
@@ -1,14 +1,13 @@
 package de.juplo.kafka.chat.backend;
 
-import de.juplo.kafka.chat.backend.domain.ChatHome;
-import de.juplo.kafka.chat.backend.persistence.StorageStrategy;
+import de.juplo.kafka.chat.backend.domain.ChatHomeService;
+import de.juplo.kafka.chat.backend.implementation.StorageStrategy;
 import jakarta.annotation.PreDestroy;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.boot.SpringApplication;
 import org.springframework.boot.autoconfigure.SpringBootApplication;
 import org.springframework.web.reactive.config.CorsRegistry;
 import org.springframework.web.reactive.config.WebFluxConfigurer;
-import reactor.core.publisher.Flux;
 
 
 @SpringBootApplication
@@ -17,7 +16,7 @@ public class ChatBackendApplication implements WebFluxConfigurer
        @Autowired
        ChatBackendProperties properties;
        @Autowired
-       ChatHome chatHome;
+       ChatHomeService chatHomeService;
        @Autowired
        StorageStrategy storageStrategy;
 
@@ -33,7 +32,7 @@ public class ChatBackendApplication implements WebFluxConfigurer
        @PreDestroy
        public void onExit()
        {
-               storageStrategy.writeChatrooms(Flux.fromStream(chatHome.list()));
+               storageStrategy.write(chatHomeService);
        }
 
        public static void main(String[] args)