diff --git a/api/pom.xml b/api/pom.xml
index 21146d1ad..d2ee65918 100644
--- a/api/pom.xml
+++ b/api/pom.xml
@@ -179,11 +179,6 @@
docker-java-api
test
-
- org.junit.platform
- junit-platform-launcher
- test
-
io.strimzi
strimzi-test-container
diff --git a/api/src/main/java/com/github/streamshub/console/api/Annotations.java b/api/src/main/java/com/github/streamshub/console/api/Annotations.java
index 5cf13832c..988083660 100644
--- a/api/src/main/java/com/github/streamshub/console/api/Annotations.java
+++ b/api/src/main/java/com/github/streamshub/console/api/Annotations.java
@@ -14,17 +14,7 @@ public enum Annotations {
* Annotation to identify a listener in Strimzi Kafka resources to be used for
* connections directly from the Console API.
*/
- CONSOLE_LISTENER("console-listener"),
-
- /**
- * Annotation to identify a listener in Strimzi Kafka resources to be used for
- * public connections. This may be used to differentiate a listener to be
- * exposed via the KafkaCluster resource and published in the UI.
- *
- * @deprecated
- */
- @Deprecated(forRemoval = true)
- EXPOSED_LISTENER("exposed-listener");
+ CONSOLE_LISTENER("console-listener");
private static final String NAMESPACE = "streamshub.github.com";
private final String value;
diff --git a/api/src/main/java/com/github/streamshub/console/api/BrokersResource.java b/api/src/main/java/com/github/streamshub/console/api/BrokersResource.java
index 4ae3b85e5..7109aba39 100644
--- a/api/src/main/java/com/github/streamshub/console/api/BrokersResource.java
+++ b/api/src/main/java/com/github/streamshub/console/api/BrokersResource.java
@@ -1,7 +1,6 @@
package com.github.streamshub.console.api;
import java.util.concurrent.CompletionStage;
-import java.util.function.Supplier;
import jakarta.inject.Inject;
import jakarta.ws.rs.GET;
@@ -11,7 +10,6 @@
import jakarta.ws.rs.core.MediaType;
import jakarta.ws.rs.core.Response;
-import org.apache.kafka.clients.admin.Admin;
import org.eclipse.microprofile.openapi.annotations.media.Content;
import org.eclipse.microprofile.openapi.annotations.parameters.Parameter;
import org.eclipse.microprofile.openapi.annotations.responses.APIResponse;
@@ -24,9 +22,6 @@
@Tag(name = "Kafka Cluster Resources")
public class BrokersResource {
- @Inject
- Supplier clientSupplier;
-
@Inject
BrokerService brokerService;
diff --git a/api/src/main/java/com/github/streamshub/console/api/ClientFactory.java b/api/src/main/java/com/github/streamshub/console/api/ClientFactory.java
index 3b07aaa1b..2e2893eeb 100644
--- a/api/src/main/java/com/github/streamshub/console/api/ClientFactory.java
+++ b/api/src/main/java/com/github/streamshub/console/api/ClientFactory.java
@@ -10,11 +10,15 @@
import java.util.Objects;
import java.util.Optional;
import java.util.Set;
+import java.util.TreeMap;
+import java.util.concurrent.ConcurrentHashMap;
+import java.util.concurrent.ScheduledExecutorService;
import java.util.concurrent.TimeUnit;
import java.util.function.Function;
import java.util.function.Predicate;
import java.util.function.Supplier;
import java.util.function.UnaryOperator;
+import java.util.regex.Matcher;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
import java.util.stream.Stream;
@@ -27,7 +31,6 @@
import jakarta.inject.Inject;
import jakarta.inject.Named;
import jakarta.ws.rs.NotFoundException;
-import jakarta.ws.rs.core.HttpHeaders;
import jakarta.ws.rs.core.UriInfo;
import org.apache.kafka.clients.CommonClientConfigs;
@@ -39,6 +42,7 @@
import org.apache.kafka.clients.producer.KafkaProducer;
import org.apache.kafka.clients.producer.Producer;
import org.apache.kafka.clients.producer.ProducerConfig;
+import org.apache.kafka.common.config.SaslConfigs;
import org.apache.kafka.common.config.SslConfigs;
import org.apache.kafka.common.serialization.ByteArrayDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;
@@ -49,6 +53,8 @@
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.dataformat.yaml.YAMLFactory;
import com.github.streamshub.console.api.service.KafkaClusterService;
+import com.github.streamshub.console.api.support.Holder;
+import com.github.streamshub.console.api.support.KafkaContext;
import com.github.streamshub.console.api.support.TrustAllCertificateManager;
import com.github.streamshub.console.config.ConsoleConfig;
import com.github.streamshub.console.config.KafkaClusterConfig;
@@ -86,12 +92,15 @@ public class ClientFactory {
@Inject
Config config;
+ @Inject
+ ScheduledExecutorService scheduler;
+
@Inject
@ConfigProperty(name = "console.config-path")
Optional configPath;
@Inject
- SharedIndexInformer kafkaInformer;
+ Holder> kafkaInformer;
@Inject
KafkaClusterService kafkaClusterService;
@@ -99,9 +108,6 @@ public class ClientFactory {
@Inject
Instance trustManager;
- @Inject
- HttpHeaders headers;
-
@Inject
UriInfo requestUri;
@@ -165,152 +171,265 @@ public ConsoleConfig produceConsoleConfig() {
});
}
- /**
- * Provides the Strimzi Kafka custom resource addressed by the current request
- * URL as an injectable bean. This allows for the Kafka to be obtained by
- * application logic without an additional lookup.
- *
- * @return a supplier that gives the Strimzi Kafka CR specific to the current
- * request
- * @throws IllegalStateException when an attempt is made to access an injected
- * Kafka Supplier but the current request does not
- * include the Kafka clusterId path parameter.
- * @throws NotFoundException when the provided Kafka clusterId does not
- * match any known Kafka cluster.
- */
@Produces
- @RequestScoped
- public Supplier kafkaResourceSupplier() {
- String clusterId = requestUri.getPathParameters().getFirst("clusterId");
+ @ApplicationScoped
+ Map produceKafkaContexts(ConsoleConfig consoleConfig,
+ Function