如果我有很多@JmsListener(destination = ...),并且在不同的队列中侦听消息,会发生什么。谁先听,我该如何控制这种行为。
@JmsListener(destination = ...)
您无法以任何有意义的方式控制精细行为;工作由操作系统调度程序调度。
您可以通过启动/停止侦听器容器来总体上控制行为-为侦听器提供id属性,并通过JmsListenerEndpointRegistry bean启动/停止容器。
id
JmsListenerEndpointRegistry
但是您无法按照other question来“控制消耗量”。我建议在那里改用JmsTemplate。
JmsTemplate