我有一个应用程序使用Spring AMQP消耗RabbitMQ的消息 . 我必须在使用者中实现Threads来处理请求 . 如果我的线程池可用,我正在使用线程消费该消息我将处理该消息 .
我有一个问题,当所有线程都忙时会发生什么 . 我没有线程来处理它 . 消息是否会从RabbitMQ中消耗掉?它会等到我的线程池可用 . 怎么用spring amqp处理这个?
Is there any thread logic to be implemented from Spring AMQP side as well ?
请建议 .
1 回答
您不应该在侦听器中添加自己的线程,它将导致消息为ack 'd early and potentially lost. Instead, use the container' s
concurrentConsumers
属性以确定要使用的线程数 .我建议你在这里问这样的问题之前先阅读所有configuration options .