Skip to content

Commit

Permalink
Merge pull request #17690 from geoand/kafka-identifier
Browse files Browse the repository at this point in the history
Use @Identifier instead of @nAmed in kafka client
  • Loading branch information
geoand authored Jun 4, 2021
2 parents 0384e81 + 11bc00f commit 4f8cf8b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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<String, Object> config;

private AdminClient client;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand All @@ -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<String, Object> createKafkaRuntimeConfig(Config config, ApplicationConfig app) {
Map<String, Object> result = new HashMap<>();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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
Expand All @@ -72,7 +72,7 @@ public class KafkaStreamsProducer {
@Inject
public KafkaStreamsProducer(KafkaStreamsSupport kafkaStreamsSupport, KafkaStreamsRuntimeConfig runtimeConfig,
Instance<Topology> topology, Instance<KafkaClientSupplier> kafkaClientSupplier,
@Named("default-kafka-broker") Instance<Map<String, Object>> defaultConfiguration,
@Identifier("default-kafka-broker") Instance<Map<String, Object>> defaultConfiguration,
Instance<StateListener> stateListener, Instance<StateRestoreListener> globalStateRestoreListener) {
shutdown = false;
// No producer for Topology -> nothing to do
Expand Down

0 comments on commit 4f8cf8b

Please sign in to comment.