84ac8deb1f6902410314a198749f0bca565a7262
[demos/kafka/chat] /
1 package de.juplo.kafka.chat.backend.persistence.storage.nostorage;
2
3 import de.juplo.kafka.chat.backend.domain.ChatRoomData;
4 import de.juplo.kafka.chat.backend.domain.ChatRoomInfo;
5 import de.juplo.kafka.chat.backend.persistence.StorageStrategy;
6 import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
7 import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
8 import org.springframework.boot.autoconfigure.data.mongo.MongoRepositoriesAutoConfiguration;
9 import org.springframework.boot.autoconfigure.mongo.MongoAutoConfiguration;
10 import org.springframework.context.annotation.Bean;
11 import org.springframework.context.annotation.Configuration;
12 import reactor.core.publisher.Flux;
13
14
15 @ConditionalOnProperty(
16     prefix = "chat.backend.inmemory",
17     name = "storage-strategy",
18     havingValue = "none",
19     matchIfMissing = true)
20 @Configuration
21 @EnableAutoConfiguration(
22     exclude = {
23         MongoRepositoriesAutoConfiguration.class,
24         MongoAutoConfiguration.class })
25 public class NoStorageStorageConfiguration
26 {
27   @Bean
28   public StorageStrategy storageStrategy()
29   {
30     return new StorageStrategy()
31     {
32       @Override
33       public void writeChatRoomInfo(Flux<ChatRoomInfo> chatRoomInfoFlux) {}
34
35       @Override
36       public Flux<ChatRoomInfo> readChatRoomInfo()
37       {
38         return Flux.empty();
39       }
40
41       @Override
42       public void writeChatRoomData(Flux<ChatRoomData> chatRoomDataFlux) {}
43
44       @Override
45       public Flux<ChatRoomData> readChatRoomData()
46       {
47         return Flux.empty();
48       }
49     };
50   }
51 }