turing85 opened a new issue, #4374: URL: https://github.com/apache/camel-quarkus/issues/4374
Background: [The usage of `@Named(...)` on injection points is discouraged by the Jakarta CDI standard](https://jakarta.ee/specifications/cdi/3.0/jakarta-cdi-spec-3.0.html#named_at_injection_point). This makes `@Named(...)` basically useless as qualifier for injection. Furthermore, [`@Named` interacts with `@Default` in unexpected ways](https://jakarta.ee/specifications/cdi/3.0/jakarta-cdi-spec-3.0.html#builtin_qualifiers). An alternative to `@Named` provided by the smallrye ecosystem is [`@io.smallrye.common.annotation.Identifier`](https://github.com/smallrye/smallrye-common/blob/main/annotation/src/main/java/io/smallrye/common/annotation/Identifier.java), which is preferred by some quarkus developers (see, for example [this discussion in the quarukusio zulip chat](https://quarkusio.zulipchat.com/#narrow/stream/187030-users/topic/.E2.9C.94.20ArC.20with.20named.20and.20unnamed.20beans)). As of now, [`camel-quarkus` integrates with `@Named`](https://camel.apache.org/camel-quarkus/2.15.x/user-guide/cdi.html#_refer_to_a_bean_by_name), but not with `@identifier`. In the long run, it would be beneficial to also support integration of `@Identifier` beans. --- Story: **As** a user of the `camel-quarkus` extension **When** I define a bean with `@Identifier("some-name")` **Then** I want to be able to reference this bean in a camel context by its `@Identifier` `"some-name"`; just as if it were defined with `@Named("some-identifier")`. --- Sample use case: - Define a `ConnectionFactory` through a `@Produces` method with an `@Identfier(...)`-name (`"externally-defined"` in this example): ``` @Produces @Typed({ ConnectionFactory.class }) @ApplicationScoped @Identifier("externally-defined") ActiveMQConnectionFactory externallyDefinedConnectionFactory( @ConfigProperty(name = "artemis.externally-defined.url") String externallyDefinedUrl) { return new ActiveMQConnectionFactory(externallyDefinedUrl); } ``` - Use the `@Identifier(...)`-name (`"externally-defined"` in this example) in a route definition: ``` @Override public void configuration() { from(jms("queue:in").connectionFactory("externally-defined")) .to(jms("queue:out").connectionFactory("externally-defined")); } ``` -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
