Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reactive Messaging - bug injecting @Stream in a class with @Observes StartupEvent #3400

Closed
famarting opened this issue Aug 1, 2019 · 0 comments
Labels
Milestone

Comments

@famarting
Copy link
Contributor

Describe the bug
Trying the last quarkus version 0.20.0 I found an issue with quarkus-smallrye-reactive-messaging-amqp that actually looks like could affect to smallrye-reactive-messaging-kafka and smallrye-reactive-messaging-mqtt too.
The issue happens at startup time (I only tried hotspot, nothing of native-image) when you inject a @Stream and in the same class you @Observes StartupEvent you get an error saying the stream can't be found eventhough having a correct configuration in the application.properties file.

My investigation makes me think the problem is in io.quarkus.smallrye.reactivemessaging.runtime.SmallRyeReactiveMessagingLifecycle which observes StartupEvent too, so then what could be happening is that io.smallrye.reactive.messaging.extension.StreamProducer which depends on io.smallrye.reactive.messaging.ChannelRegistry doesn't know of any registered publisher or subscriber because the MediatorManager isn't initializated because my StartupEvent listener executes before the one in SmallRyeReactiveMessagingLifecycle.

The first solution that comes to my mind is to change the event that SmallRyeReactiveMessagingLifecycle listen's to another one but I don't actually know what event could be used. Another solution could be to prioritize somehow the execution of the events in listeners from quarkus extensions

Expected behavior
Application successfully starts

Actual behavior
This error appears when trying to run the application

	at io.smallrye.reactive.messaging.extension.StreamProducer.getPublisher(StreamProducer.java:68)
	at io.smallrye.reactive.messaging.extension.StreamProducer.producePublisher(StreamProducer.java:38)
	at io.smallrye.reactive.messaging.extension.StreamProducer_ProducerMethod_producePublisher_78a82f199fc91074cdfbd65c72662644b3754ad7_Bean.create(StreamProducer_ProducerMethod_producePublisher_78a82f199fc91074cdfbd65c72662644b3754ad7_Bean.zig:110)
	at io.smallrye.reactive.messaging.extension.StreamProducer_ProducerMethod_producePublisher_78a82f199fc91074cdfbd65c72662644b3754ad7_Bean.get(StreamProducer_ProducerMethod_producePublisher_78a82f199fc91074cdfbd65c72662644b3754ad7_Bean.zig:333)
	at io.smallrye.reactive.messaging.extension.StreamProducer_ProducerMethod_producePublisher_78a82f199fc91074cdfbd65c72662644b3754ad7_Bean.get(StreamProducer_ProducerMethod_producePublisher_78a82f199fc91074cdfbd65c72662644b3754ad7_Bean.zig:57)
	at io.quarkus.arc.CurrentInjectionPointProvider.get(CurrentInjectionPointProvider.java:50)
	at org.acme.quarkus.sample.PriceConverter_Bean.create(PriceConverter_Bean.zig:222)
	at org.acme.quarkus.sample.PriceConverter_Bean.create(PriceConverter_Bean.zig:28)

To Reproduce
I have a fork of the amqp-quickstart with small modifications to reproduce the issue
https://github.com/famartinrh/quarkus-quickstarts/tree/master/amqp-quickstart
Just run the quickstart and see the application fails to start

Environment (please complete the following information):

  • Output of uname -a or ver: Linux localhost.localdomain 5.1.18-200.fc29.x86_64 #1 SMP Mon Jul 15 16:09:08 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
  • Output of java -version: openjdk version "11.0.2" 2019-01-15 OpenJDK Runtime Environment 18.9 (build 11.0.2+9) OpenJDK 64-Bit Server VM 18.9 (build 11.0.2+9, mixed mode)
  • Quarkus version or git rev: 0.20.0
@famarting famarting added the kind/bug Something isn't working label Aug 1, 2019
@famarting famarting changed the title Reactive Messaging - bug injecting @Stream in a class which @Observes StartupEvent Reactive Messaging - bug injecting @Stream in a class with @Observes StartupEvent Aug 1, 2019
@mkouba mkouba added this to the 0.21.0 milestone Aug 2, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants