1 package de.juplo.kafka.chat.backend;
5 import org.springframework.boot.context.properties.ConfigurationProperties;
7 import java.nio.file.Paths;
10 @ConfigurationProperties("chat.backend")
13 public class ChatBackendProperties
15 private String allowedOrigins = "http://localhost:4200";
16 private int chatroomBufferSize = 8;
17 private ServiceType services = ServiceType.inmemory;
18 private InMemoryServicesProperties inmemory = new InMemoryServicesProperties();
19 private KafkaServicesProperties kafka = new KafkaServicesProperties();
24 public static class InMemoryServicesProperties
26 private ShardingStrategyType shardingStrategy = ShardingStrategyType.none;
27 private int numShards = 1;
28 private int[] ownedShards = new int[] { 0 };
29 private StorageStrategyType storageStrategy = StorageStrategyType.none;
30 private String storageDirectory = Paths.get(System.getProperty("java.io.tmpdir"),"chat", "backend").toString();
35 public static class KafkaServicesProperties
37 private String clientIdPrefix;
38 private String bootstrapServers = ":9092";
39 private String chatRoomChannelTopic = "message_channel";
40 private int numPartitions = 2;
43 public enum ServiceType { inmemory, kafka }
44 public enum StorageStrategyType { none, files, mongodb }
45 public enum ShardingStrategyType { none, kafkalike }