Skip to content

Commit

Permalink
Fix 009 module to use @Identifier instead of @nAmed to inject broker
Browse files Browse the repository at this point in the history
This change is related to quarkusio/quarkus@11bc00f.
The problem is that keeping injecting the default Kafka broker using `@Named` is now failing:

```java
@ApplicationScoped
public class KafkaProviders {

    @Inject
    @nAmed("default-kafka-broker")
    Map<String, Object> config;
}
```

Using:

```java
@ApplicationScoped
public class KafkaProviders {

    @Inject
    @Identifier("default-kafka-broker")
    Map<String, Object> config;
}
```

It works. 

Therefore, this is a breaking change that should be noted in the Migration guide for 2.x.
  • Loading branch information
Sgitario committed Jun 9, 2021
1 parent 2123e04 commit b260387
Showing 1 changed file with 3 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import javax.enterprise.context.ApplicationScoped;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;

import org.apache.kafka.clients.admin.AdminClient;
import org.apache.kafka.clients.admin.AdminClientConfig;
Expand All @@ -16,11 +15,13 @@
import org.apache.kafka.common.serialization.StringDeserializer;
import org.apache.kafka.common.serialization.StringSerializer;

import io.smallrye.common.annotation.Identifier;

@ApplicationScoped
public class KafkaProviders {

@Inject
@Named("default-kafka-broker")
@Identifier("default-kafka-broker")
Map<String, Object> config;

@Produces
Expand Down

0 comments on commit b260387

Please sign in to comment.