|
@@ -2,6 +2,7 @@ package com.provectus.kafka.ui.service;
|
|
|
|
|
|
import com.provectus.kafka.ui.client.RetryingKafkaConnectClient;
|
|
|
import com.provectus.kafka.ui.config.ClustersProperties;
|
|
|
+import com.provectus.kafka.ui.config.WebclientProperties;
|
|
|
import com.provectus.kafka.ui.connect.api.KafkaConnectClientApi;
|
|
|
import com.provectus.kafka.ui.emitter.PollingSettings;
|
|
|
import com.provectus.kafka.ui.model.ApplicationPropertyValidationDTO;
|
|
@@ -22,9 +23,7 @@ import java.util.Optional;
|
|
|
import java.util.Properties;
|
|
|
import java.util.stream.Stream;
|
|
|
import javax.annotation.Nullable;
|
|
|
-import lombok.RequiredArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
-import org.springframework.beans.factory.annotation.Value;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
import org.springframework.util.unit.DataSize;
|
|
|
import org.springframework.web.reactive.function.client.WebClient;
|
|
@@ -34,12 +33,18 @@ import reactor.util.function.Tuple2;
|
|
|
import reactor.util.function.Tuples;
|
|
|
|
|
|
@Service
|
|
|
-@RequiredArgsConstructor
|
|
|
@Slf4j
|
|
|
public class KafkaClusterFactory {
|
|
|
|
|
|
- @Value("${webclient.max-in-memory-buffer-size:20MB}")
|
|
|
- private DataSize maxBuffSize;
|
|
|
+ private static final DataSize DEFAULT_WEBCLIENT_BUFFER = DataSize.parse("20MB");
|
|
|
+
|
|
|
+ private final DataSize webClientMaxBuffSize;
|
|
|
+
|
|
|
+ public KafkaClusterFactory(WebclientProperties webclientProperties) {
|
|
|
+ this.webClientMaxBuffSize = Optional.ofNullable(webclientProperties.getMaxInMemoryBufferSize())
|
|
|
+ .map(DataSize::parse)
|
|
|
+ .orElse(DEFAULT_WEBCLIENT_BUFFER);
|
|
|
+ }
|
|
|
|
|
|
public KafkaCluster create(ClustersProperties properties,
|
|
|
ClustersProperties.Cluster clusterProperties) {
|
|
@@ -140,7 +145,7 @@ public class KafkaClusterFactory {
|
|
|
url -> new RetryingKafkaConnectClient(
|
|
|
connectCluster.toBuilder().address(url).build(),
|
|
|
cluster.getSsl(),
|
|
|
- maxBuffSize
|
|
|
+ webClientMaxBuffSize
|
|
|
),
|
|
|
ReactiveFailover.CONNECTION_REFUSED_EXCEPTION_FILTER,
|
|
|
"No alive connect instances available",
|
|
@@ -158,7 +163,7 @@ public class KafkaClusterFactory {
|
|
|
WebClient webClient = new WebClientConfigurator()
|
|
|
.configureSsl(clusterProperties.getSsl(), clusterProperties.getSchemaRegistrySsl())
|
|
|
.configureBasicAuth(auth.getUsername(), auth.getPassword())
|
|
|
- .configureBufferSize(maxBuffSize)
|
|
|
+ .configureBufferSize(webClientMaxBuffSize)
|
|
|
.build();
|
|
|
return ReactiveFailover.create(
|
|
|
parseUrlList(clusterProperties.getSchemaRegistry()),
|
|
@@ -181,7 +186,7 @@ public class KafkaClusterFactory {
|
|
|
clusterProperties.getKsqldbServerAuth(),
|
|
|
clusterProperties.getSsl(),
|
|
|
clusterProperties.getKsqldbServerSsl(),
|
|
|
- maxBuffSize
|
|
|
+ webClientMaxBuffSize
|
|
|
),
|
|
|
ReactiveFailover.CONNECTION_REFUSED_EXCEPTION_FILTER,
|
|
|
"No live ksqldb instances available",
|