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 instanceId = "DEV";
17 private String allowedOrigins = "http://localhost:4200";
18 private int chatroomBufferSize = 8;
19 private ServiceType services = ServiceType.inmemory;
20 private InMemoryServicesProperties inmemory = new InMemoryServicesProperties();
21 private KafkaServicesProperties kafka = new KafkaServicesProperties();
26 public static class InMemoryServicesProperties
28 private ShardingStrategyType shardingStrategy = ShardingStrategyType.none;
29 private int numShards = 1;
30 private int[] ownedShards = new int[0];
31 private URI[] shardOwners = new URI[0];
32 private StorageStrategyType storageStrategy = StorageStrategyType.none;
33 private String storageDirectory = Paths.get(System.getProperty("java.io.tmpdir"),"chat", "backend").toString();
38 public static class KafkaServicesProperties
40 private URI instanceUri = URI.create("http://localhost:8080");
41 private String clientIdPrefix = "DEV";
42 private String bootstrapServers = ":9092";
43 private String infoChannelTopic = "info_channel";
44 private String dataChannelTopic = "data_channel";
45 private int numPartitions = 2;
48 public enum ServiceType { inmemory, kafka }
49 public enum StorageStrategyType { none, files, mongodb }
50 public enum ShardingStrategyType { none, kafkalike }