1 package de.juplo.kafka.chat.backend;
5 import org.springframework.boot.context.properties.ConfigurationProperties;
8 import java.nio.file.Paths;
11 @ConfigurationProperties("chat.backend")
14 public class ChatBackendProperties
16 private String allowedOrigins = "http://localhost:4200";
17 private int chatroomBufferSize = 8;
18 private ServiceType services = ServiceType.inmemory;
19 private InMemoryServicesProperties inmemory = new InMemoryServicesProperties();
20 private KafkaServicesProperties kafka = new KafkaServicesProperties();
25 public static class InMemoryServicesProperties
27 private ShardingStrategyType shardingStrategy = ShardingStrategyType.none;
28 private int numShards = 1;
29 private int[] ownedShards = new int[0];
30 private URI[] shardOwners = new URI[0];
31 private StorageStrategyType storageStrategy = StorageStrategyType.none;
32 private String storageDirectory = Paths.get(System.getProperty("java.io.tmpdir"),"chat", "backend").toString();
37 public static class KafkaServicesProperties
39 private URI instanceUri = URI.create("http://localhost:8080");
40 private String clientIdPrefix = "DEV";
41 private String bootstrapServers = ":9092";
42 private String infoChannelTopic = "info_channel";
43 private String dataChannelTopic = "data_channel";
44 private int numPartitions = 2;
47 public enum ServiceType { inmemory, kafka }
48 public enum StorageStrategyType { none, files, mongodb }
49 public enum ShardingStrategyType { none, kafkalike }