1 package de.juplo.kafka.chat.backend.persistence.storage.mongodb;
3 import de.juplo.kafka.chat.backend.ChatBackendProperties;
4 import de.juplo.kafka.chat.backend.persistence.StorageStrategy;
5 import de.juplo.kafka.chat.backend.persistence.inmemory.InMemoryChatRoomService;
6 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
7 import org.springframework.context.annotation.Bean;
8 import org.springframework.context.annotation.Configuration;
10 import java.time.Clock;
13 @ConditionalOnProperty(
14 prefix = "chat.backend",
16 havingValue = "mongodb")
18 public class MongoDbStorageConfiguration
21 public StorageStrategy storageStrategy(
22 ChatRoomRepository chatRoomRepository,
23 ChatBackendProperties properties,
26 return new MongoDbStorageStrategy(
29 properties.getChatroomBufferSize(),
30 messageFlux -> new InMemoryChatRoomService(messageFlux));