Control consumption of multiple JMS queues

别说谁变了你拦得住时间么 提交于 2020-01-21 19:18:12

问题


I can't find this information anywhere. I have two queues, @JmsListener(destination = "p1"), @JmsListener(destination = "p2"). How can I make sure I only process 1 message at a time, even though I am listening to 2 queues, and also how do I configure the polling of what queue I get messages from first, that is after processing a message I want to poll p1 first. Or do weighted polling: p1:90%, p2:10%. Etc.

Basically I am asking how to implement priority processing of messages for Spring. I'm using SQS which doesn't support priorities.


回答1:


Use one of the JmsTemplate receive() or receiveAndConvert() methods instead of the message-driven model.

Use transactions if you want to ensure no message loss.



来源:https://stackoverflow.com/questions/59277342/control-consumption-of-multiple-jms-queues

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!