1 package de.juplo.kafka.chat.backend;
5 import org.springframework.boot.context.properties.ConfigurationProperties;
8 import java.nio.file.Paths;
9 import java.util.logging.Level;
12 @ConfigurationProperties("chat.backend")
15 public class ChatBackendProperties
17 private String instanceId = "DEV";
18 private String allowedOrigins = "http://localhost:4200";
19 private int chatroomBufferSize = 8;
20 private ServiceType services = ServiceType.inmemory;
21 private InMemoryServicesProperties inmemory = new InMemoryServicesProperties();
22 private KafkaServicesProperties kafka = new KafkaServicesProperties();
23 private ProjectreactorProperties projectreactor = new ProjectreactorProperties();
28 public static class InMemoryServicesProperties
30 private ShardingStrategyType shardingStrategy = ShardingStrategyType.none;
31 private int numShards = 1;
32 private int[] ownedShards = new int[0];
33 private URI[] shardOwners = new URI[0];
34 private StorageStrategyType storageStrategy = StorageStrategyType.none;
35 private String storageDirectory = Paths.get(System.getProperty("java.io.tmpdir"),"chat", "backend").toString();
40 public static class KafkaServicesProperties
42 private URI instanceUri = URI.create("http://localhost:8080");
43 private String clientIdPrefix = "DEV";
44 private String bootstrapServers = ":9092";
45 private String infoChannelTopic = "info_channel";
46 private String dataChannelTopic = "data_channel";
47 private int numPartitions = 2;
48 private String haproxyRuntimeApi = "haproxy:8401";
49 private String haproxyMap = "/usr/local/etc/haproxy/sharding.map";
54 public static class ProjectreactorProperties
56 private Level loggingLevel = Level.FINE;
57 private boolean showOperatorLine = true;
59 public enum ServiceType { inmemory, kafka }
60 public enum StorageStrategyType { none, files, mongodb }
61 public enum ShardingStrategyType { none, kafkalike }