我有一个应用程序使用 Spring AMQP 使用来自 RabbitMQ 的消息。 我必须在消费者中实现线程来处理请求。如果我的线程池可用,我将使用线程来处理消息。
I have a question where what happens when all the threads are busy. I dont have a threads to process it. Will the message be consumed from RabbitMQ ? Will it wait till my thread pool becomes available. How do handle this using spring amqp?
是否也有任何线程逻辑要从 Spring AMQP 端实现?
请提出建议。
最佳答案
你不应该在你的监听器中添加你自己的线程,它会导致消息被提前确认并可能丢失。相反,使用容器的 concurrentConsumers
属性来确定要使用的线程数。
我建议您阅读所有 configuration options在这里问这样的问题之前。
关于java - 消费消息时Spring AMQP中的线程实现,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39547669/