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