I need to consume messages from RabbitMQ in a microservice written using Quarkus. I tried to use the smallrye-reactive-messaging for Quarkus but faced two problems:
- it only supports AMQP 1.0 and doesn't work with RabbitMQ (even if I use the experimental AMQP 1.0 plugin).
- it works with ActiveMQ Artemis but there's another issue: The smallrye-reactive-messaging is... reactive which is nice but there's no time right now to rewrite my database code to be reactive. Processing the message means persisting tens of thousands of documents to the mongodb which can take several minutes and it seems to be blocking the whole server:
WARNING [io.ver.cor.imp.BlockedThreadChecker] (vertx-blocked-thread-checker) Thread Thread[vert.x-eventloop-thread-0,5,main]=Thread[vert.x-eventloop-thread-0,5,main] has been blocked for 212088 ms, time limit is 2000 ms: io.vertx.core.VertxException: Thread blocked
So my idea for a workaround is to start a thread for consuming and processing the messages somewhere in Quarkus when it boots up. There's a support for scheduling periodic tasks in Quarkus is there's an annotation for background processes or do I have to write my own extension?