X-Git-Url: http://juplo.de/gitweb/?a=blobdiff_plain;f=src%2Fmain%2Fjava%2Fde%2Fjuplo%2Fkafka%2Fchat%2Fbackend%2FChatBackendProperties.java;h=21330e17580909b35f6ad97203056a78942a100f;hb=46cafb65876ccec33ef4e9948fad2e4aa526039a;hp=177d4f513b7e86efcb4577052cf41f9acc6cd20b;hpb=5e027064643ea9060c3a2cc8f4272360fa02abd3;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 177d4f51..21330e17 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java +++ b/src/main/java/de/juplo/kafka/chat/backend/ChatBackendProperties.java @@ -4,6 +4,7 @@ import lombok.Getter; import lombok.Setter; import org.springframework.boot.context.properties.ConfigurationProperties; +import java.net.URI; import java.nio.file.Paths; @@ -12,10 +13,14 @@ import java.nio.file.Paths; @Setter public class ChatBackendProperties { + private String instanceId = "DEV"; 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(); + private String haproxyRuntimeApi = "haproxy:8401"; + private String haproxyMap = "/usr/local/etc/haproxy/sharding.map"; @Getter @@ -24,12 +29,25 @@ public class ChatBackendProperties { private ShardingStrategyType shardingStrategy = ShardingStrategyType.none; private int numShards = 1; - private int[] ownedShards = new int[] { 0 }; - private StorageStrategyType storageStrategy = StorageStrategyType.files; + private int[] ownedShards = new int[0]; + private URI[] shardOwners = new URI[0]; + private StorageStrategyType storageStrategy = StorageStrategyType.none; private String storageDirectory = Paths.get(System.getProperty("java.io.tmpdir"),"chat", "backend").toString(); } - public enum ServiceType { inmemory } - public enum StorageStrategyType { files, mongodb } + @Getter + @Setter + public static class KafkaServicesProperties + { + private URI instanceUri = URI.create("http://localhost:8080"); + private String clientIdPrefix = "DEV"; + private String bootstrapServers = ":9092"; + private String infoChannelTopic = "info_channel"; + private String dataChannelTopic = "data_channel"; + private int numPartitions = 2; + } + + public enum ServiceType { inmemory, kafka } + public enum StorageStrategyType { none, files, mongodb } public enum ShardingStrategyType { none, kafkalike } }