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 @Incoming("executor-in")
annotation where I log what was consumed (Executor
object). I also created MessageConverter
where I convert from Json string to object (Executor
). Now when I send serialized Executor
object inside my Junit 5 test I get java.lang.IllegalStateException: No CDI container is available
which I do not know why. This happens if I run the test inside Intellij.
UPDATE
One important thing is that the test is working but method for message consuming is not being called.
The funny thing is that if I do not convert Json to Executor (inside MessageConverter
class) object and just resend Message<?>
with Json payload and change method argument from Executor
to String
then everything works
To not too much pollute the space with the code I also attach link to project on GitHub: link
Thanks for any help in advance.
The answer can be found on GitHub here. The problem was following (answer from GitHub by Ladicek user):
... 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. ...