quarkus: WiringProcessor incorrectly produces "mp.messaging.incoming." configuration property.
Describe the bug
WiringProcessor incorrectly produces “mp.messaging.incoming.”<channel name> configuration property for each injection point qualified with @Channel
annotation and is not Emitter
nor MutinyEmitter
.
See extensions/smallrye-reactive-messaging/deployment/src/main/java/io/quarkus/smallrye/reactivemessaging/deployment/WiringProcessor.java
if (channel.isPresent() && !(isEmitter || isMutinyEmitter)) {
handleChannelInjection(appChannels, channels, channel.get());
}
There is no check for injected type being Publisher
or PublisherBuilder
or one with configured EmitterFactory
.
If you also have configured outgoing channel with the same name there will be runtime exception during Smallrye initialization:
SRMSG00073: Invalid configuration, the following channel names cannot be used for both incoming and outgoing [<channel name>]
This behaviour prevents you from using @Channel
as a regular qualifier for custom CDI injection.
Expected behavior
Quarkus deployment extension must not produce incoming channel configuration for injection points qualified with @Channel
which is not Emitter
, MutinyEmitter
, Publisher
, PublisherBuilder
or one with configured EmitterFactory
.
Actual behavior
Quarkus deployment extension produces “mp.messaging.incoming.”<channel name> configuration property for each injection point qualified with @Channel
annotation and is not Emitter
nor MutinyEmitter
.
How to Reproduce?
- Add channel outgoing configuration in config file
# you may use any connector name, but connector must be specified
mp.messaging.outgoing.test.connector=test
mp.messaging.outgoing.test.address=test
- Create CDI bean definition with
@Channel
qualified producer method
interface TestBean {
fun call()
}
@ApplicationScoped
class TestBeanFactory {
@Produces
@Channel("")
fun testBean() = object : TestBean {
override fun call() {
}
}
}
- Create CDI bean to inject our test bean
@ApplicationScoped
class TestApp(@param:Channel("test") private val testBean: TestBean) {
fun onStart(@Observes event: StartupEvent) {
testBean.call()
}
}
- Run the app and you will see error:
SRMSG00073: Invalid configuration, the following channel names cannot be used for both incoming and outgoing: [test]
About this issue
- Original URL
- State: closed
- Created 2 years ago
- Comments: 18 (10 by maintainers)
I’ve already tried it (thought I’ve responded but…). It’s works.