Running Quarkus test with reactive messaging and get java.lang.IllegalStateException: No CDI container is available #43902
-
I am trying to learn quarkus-messaging-amqp and that is why I created a very simple project where I have one consumer which has The funny thing is that if I do not convert Json to To not pollute the space too much with the code I also attach link to project on GitHub: link Thanks for any help in advance. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 4 replies
-
/cc @Ladicek (arc), @cescoffier (reactive-messaging), @manovotn (arc), @mkouba (arc), @ozangunalp (reactive-messaging) |
Beta Was this translation helpful? Give feedback.
-
This is because your test sends the message and immediately stops; it doesn't wait for the processing to finish. When Quarkus stops, an exception like this can happen very easily (as well as a bunch of other exceptions). If you for example add |
Beta Was this translation helpful? Give feedback.
-
@Ladicek Sorry for my late response, but I had a lot of other things to do. Yes, you are totally right. I have tried with your proposal of Thread.sleep(5000) and also with waiting for the message to be delivered, and it both works. Thanks for your quick reply 👍. I will also post this answer on the StackOverflow site (here) where I created the initial question. |
Beta Was this translation helpful? Give feedback.
This is because your test sends the message and immediately stops; it doesn't wait for the processing to finish. When Quarkus stops, an exception like this can happen very easily (as well as a bunch of other exceptions). If you for example add
Thread.sleep(5000)
to the end of the@Test
method, the exception isn't thrown.