private ServiceType services = ServiceType.inmemory;
private InMemoryServicesProperties inmemory = new InMemoryServicesProperties();
private KafkaServicesProperties kafka = new KafkaServicesProperties();
- private URI haproxyRuntimeApiUri = URI.create("haproxy:8401");
+ private String haproxyRuntimeApi = "haproxy:8401";
private String haproxyInstanceId = "DEV";
import de.juplo.kafka.chat.backend.domain.ShardingPublisherStrategy;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
-import org.springframework.web.reactive.function.client.WebClient;
import reactor.core.publisher.Mono;
-import java.net.URI;
-
@RequiredArgsConstructor
@Slf4j
public class HaproxyShardingPublisherStrategy implements ShardingPublisherStrategy
{
+ private final String host;
+ private final int port;
private final String instanceId;
- private final WebClient webClient;
@Override
@Bean
ShardingPublisherStrategy shardingPublisherStrategy(
- ChatBackendProperties properties,
- WebClient.Builder webClientBuilder)
+ ChatBackendProperties properties)
{
- String baseUrl = properties.getHaproxyRuntimeApiUri().toASCIIString();
- WebClient webClient = webClientBuilder.baseUrl(baseUrl).build();
+ String[] parts = properties.getHaproxyRuntimeApi().split(":");
return new HaproxyShardingPublisherStrategy(
- properties.getHaproxyInstanceId(),
- webClient);
+ parts[0],
+ Integer.valueOf(parts[1]),
+ properties.getHaproxyInstanceId());
}
@Bean