From 11bc00f324b6ed4166ab4250e6661060b7d1a4d4 Mon Sep 17 00:00:00 2001 From: Georgios Andrianakis Date: Fri, 4 Jun 2021 09:59:25 +0300 Subject: [PATCH] Use @Identifier instead of @Named in kafka client This is needed to remove a warning from SR RM --- .../io/quarkus/kafka/client/health/KafkaHealthCheck.java | 5 +++-- .../kafka/client/runtime/KafkaRuntimeConfigProducer.java | 4 ++-- .../quarkus/kafka/streams/runtime/KafkaStreamsProducer.java | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/health/KafkaHealthCheck.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/health/KafkaHealthCheck.java index 232e2213cb299..a0b7c6648caa7 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/health/KafkaHealthCheck.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/health/KafkaHealthCheck.java @@ -7,7 +7,6 @@ import javax.annotation.PreDestroy; import javax.enterprise.context.ApplicationScoped; import javax.inject.Inject; -import javax.inject.Named; import org.apache.kafka.clients.admin.AdminClient; import org.apache.kafka.clients.admin.AdminClientConfig; @@ -17,12 +16,14 @@ import org.eclipse.microprofile.health.HealthCheckResponseBuilder; import org.eclipse.microprofile.health.Readiness; +import io.smallrye.common.annotation.Identifier; + @Readiness @ApplicationScoped public class KafkaHealthCheck implements HealthCheck { @Inject - @Named("default-kafka-broker") + @Identifier("default-kafka-broker") Map config; private AdminClient client; diff --git a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java index a61a496280f5f..61ddbfde3ce30 100644 --- a/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java +++ b/extensions/kafka-client/runtime/src/main/java/io/quarkus/kafka/client/runtime/KafkaRuntimeConfigProducer.java @@ -4,13 +4,13 @@ import java.util.Map; import javax.enterprise.inject.Produces; -import javax.inject.Named; import javax.inject.Singleton; import org.eclipse.microprofile.config.Config; import io.quarkus.arc.DefaultBean; import io.quarkus.runtime.ApplicationConfig; +import io.smallrye.common.annotation.Identifier; @Singleton public class KafkaRuntimeConfigProducer { @@ -23,7 +23,7 @@ public class KafkaRuntimeConfigProducer { @Produces @DefaultBean @Singleton - @Named("default-kafka-broker") // TODO Should use @Identifier soon + @Identifier("default-kafka-broker") public Map createKafkaRuntimeConfig(Config config, ApplicationConfig app) { Map result = new HashMap<>(); diff --git a/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java b/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java index 11f7ff429fb96..408fa5d0957ec 100644 --- a/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java +++ b/extensions/kafka-streams/runtime/src/main/java/io/quarkus/kafka/streams/runtime/KafkaStreamsProducer.java @@ -26,7 +26,6 @@ import javax.enterprise.inject.Instance; import javax.enterprise.inject.Produces; import javax.inject.Inject; -import javax.inject.Named; import javax.inject.Singleton; import org.apache.kafka.clients.CommonClientConfigs; @@ -48,6 +47,7 @@ import io.quarkus.arc.Unremovable; import io.quarkus.runtime.ShutdownEvent; import io.quarkus.runtime.Startup; +import io.smallrye.common.annotation.Identifier; /** * Manages the lifecycle of a Kafka Streams pipeline. If there's a producer @@ -72,7 +72,7 @@ public class KafkaStreamsProducer { @Inject public KafkaStreamsProducer(KafkaStreamsSupport kafkaStreamsSupport, KafkaStreamsRuntimeConfig runtimeConfig, Instance topology, Instance kafkaClientSupplier, - @Named("default-kafka-broker") Instance> defaultConfiguration, + @Identifier("default-kafka-broker") Instance> defaultConfiguration, Instance stateListener, Instance globalStateRestoreListener) { shutdown = false; // No producer for Topology -> nothing to do