X-Git-Url: https://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fkafka%2Fchat%2Fbackend%2FChatBackendProperties.java;h=cb5684c212b2be96b038f957fef2eb1dd76fcec4;hb=6f8bd42a20085f186a27d2aeac8aedaf05a7e746;hp=48e581652e215f56fd811d47084f7e238d758bc6;hpb=af3553a0f5093819fc2af088b974375c7102ed9d;p=demos%2Fkafka%2Fchat diff --git a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java index 48e58165..cb5684c2 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java +++ b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java @@ -12,7 +12,35 @@ import java.nio.file.Paths; @Setter public class ChatBackendProperties { - private String storageDirectory = Paths.get(System.getProperty("java.io.tmpdir"),"chat", "backend").toString(); private String allowedOrigins = "http://localhost:4200"; private int chatroomBufferSize = 8; + private ServiceType services = ServiceType.inmemory; + private InMemoryServicesProperties inmemory = new InMemoryServicesProperties(); + private KafkaServicesProperties kafka = new KafkaServicesProperties(); + + + @Getter + @Setter + public static class InMemoryServicesProperties + { + private ShardingStrategyType shardingStrategy = ShardingStrategyType.none; + private int numShards = 1; + private int[] ownedShards = new int[] { 0 }; + private StorageStrategyType storageStrategy = StorageStrategyType.files; + private String storageDirectory = Paths.get(System.getProperty("java.io.tmpdir"),"chat", "backend").toString(); + } + + @Getter + @Setter + public static class KafkaServicesProperties + { + private String clientIdPrefix; + private String bootstrapServers = ":9092"; + private String topic = "test"; + private int numPartitions = 2; + } + + public enum ServiceType { inmemory, kafka } + public enum StorageStrategyType { files, mongodb } + public enum ShardingStrategyType { none, kafkalike } }