当您在Spring中有多个JMS侦听器竞争处理资源时,会发生什么情况?

如果我有很多function MyNumber(num) { this.num = num; } MyNumber.prototype.increment = function() { ++this.num; } let myNumA = new MyNumber(10); let myNumB = new MyNumber(100); console.log(myNumA.num); // 10 console.log(myNumB.num); // 100 myNumB.increment(); console.log(myNumA.num); // 10 console.log(myNumB.num); // 101,在不同的队列中侦听消息,该怎么办。谁先听,我该如何控制这种行为。

zxj3125 回答:当您在Spring中有多个JMS侦听器竞争处理资源时,会发生什么情况?

您不能以任何有意义的方式来控制精细行为。工作由操作系统调度程序调度。

您可以通过启动/停止监听器容器来总体上控制行为-为监听器提供id属性,并通过JmsListenerEndpointRegistry bean启动/停止容器。

但是您无法按照other question“控制消费量”。我建议在那里改用JmsTemplate

本文链接:https://www.f2er.com/2945198.html

大家都在问