From: Kai Moritz Date: Sun, 17 Sep 2023 09:43:30 +0000 (+0200) Subject: WIP:haproxy X-Git-Tag: rebase--2024-01-26--18-11~12 X-Git-Url: http://juplo.de/gitweb/?a=commitdiff_plain;h=009de3f23d6930eab48fdc22c16bee7049835eb6;p=demos%2Fkafka%2Fchat WIP:haproxy --- diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/haproxy/HaproxyShardingPublisherStrategy.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/haproxy/HaproxyShardingPublisherStrategy.java index 296d64fe..7835b188 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/haproxy/HaproxyShardingPublisherStrategy.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/haproxy/HaproxyShardingPublisherStrategy.java @@ -13,7 +13,7 @@ import java.net.URI; @Slf4j public class HaproxyShardingPublisherStrategy implements ShardingPublisherStrategy { - private final URI runtimeApiUri; + private final String instanceId; private final WebClient webClient; diff --git a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaServicesConfiguration.java b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaServicesConfiguration.java index 4f646f60..a575e07d 100644 --- a/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaServicesConfiguration.java +++ b/src/main/java/de/juplo/kafka/chat/backend/implementation/kafka/KafkaServicesConfiguration.java @@ -285,10 +285,12 @@ public class KafkaServicesConfiguration @Bean ShardingPublisherStrategy shardingPublisherStrategy( ChatBackendProperties properties, - WebClient webClient) + WebClient.Builder webClientBuilder) { + String baseUrl = properties.getHaproxyRuntimeApiUri().toASCIIString(); + WebClient webClient = webClientBuilder.baseUrl(baseUrl).build(); return new HaproxyShardingPublisherStrategy( - properties.getHaproxyRuntimeApiUri(), + properties.getHaproxyInstanceId(), webClient); }