WIP:mongodb map vs subscribe
authorKai Moritz <kai@juplo.de>
Sun, 18 Feb 2024 18:09:00 +0000 (19:09 +0100)
committerKai Moritz <kai@juplo.de>
Sun, 18 Feb 2024 18:09:00 +0000 (19:09 +0100)
src/main/java/de/juplo/kafka/chat/backend/storage/mongodb/MongoDbStorageStrategy.java

index 16bde24..780d64b 100644 (file)
@@ -25,7 +25,7 @@ public class MongoDbStorageStrategy implements StorageStrategy
   {
     chatRoomInfoFlux
         .map(ChatRoomTo::from)
-        .flatMap(chatroomTo -> chatRoomRepository.save(chatroomTo))
+        .map(chatroomTo -> chatRoomRepository.save(chatroomTo))
         .subscribe();
   }
 
@@ -46,7 +46,7 @@ public class MongoDbStorageStrategy implements StorageStrategy
   {
     messageFlux
         .map(message -> MessageTo.from(chatRoomId, message))
-        .flatMap(messageTo -> messageRepository.save(messageTo))
+        .map(messageTo -> messageRepository.save(messageTo))
         .subscribe();
   }