feat: Introduced config-parameters for the `io.projectreactor`-logging
[demos/kafka/chat] / src / main / java / de / juplo / kafka / chat / backend / ChatBackendProperties.java
1 package de.juplo.kafka.chat.backend;
2
3 import lombok.Getter;
4 import lombok.Setter;
5 import org.springframework.boot.context.properties.ConfigurationProperties;
6
7 import java.net.URI;
8 import java.nio.file.Paths;
9 import java.util.logging.Level;
10
11
12 @ConfigurationProperties("chat.backend")
13 @Getter
14 @Setter
15 public class ChatBackendProperties
16 {
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();
24
25
26   @Getter
27   @Setter
28   public static class InMemoryServicesProperties
29   {
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();
36   }
37
38   @Getter
39   @Setter
40   public static class KafkaServicesProperties
41   {
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";
50   }
51
52   @Getter
53   @Setter
54   public static class ProjectreactorProperties
55   {
56     private Level loggingLevel = Level.FINE;
57     private boolean showOperatorLine = true;
58   }
59   public enum ServiceType { inmemory, kafka }
60   public enum StorageStrategyType { none, files, mongodb }
61   public enum ShardingStrategyType { none, kafkalike }
62 }