WIP: shard assigned/revoked events
[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
10
11 @ConfigurationProperties("chat.backend")
12 @Getter
13 @Setter
14 public class ChatBackendProperties
15 {
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();
21
22
23   @Getter
24   @Setter
25   public static class InMemoryServicesProperties
26   {
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();
33   }
34
35   @Getter
36   @Setter
37   public static class KafkaServicesProperties
38   {
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;
45   }
46
47   public enum ServiceType { inmemory, kafka }
48   public enum StorageStrategyType { none, files, mongodb }
49   public enum ShardingStrategyType { none, kafkalike }
50 }