我们可以看到SimpleMessageListenerContainer
具有名为concurrentConsumers
的属性,但SimpleJmsListenerContainerFactory
不支持配置它。根本原因是什么?不建议对SimpleMessageListenerContainer
使用并发性?
答案 0 :(得分:0)
在@JmsListener
注释上设置并发:
/**
* The concurrency limits for the listener, if any. Overrides the value defined
* by the container factory used to create the listener container.
* <p>The concurrency limits can be a "lower-upper" String — for example,
* "5-10" — or a simple upper limit String — for example, "10", in
* which case the lower limit will be 1.
* <p>Note that the underlying container may or may not support all features.
* For instance, it may not be able to scale, in which case only the upper limit
* is used.
*/
String concurrency() default "";
看起来Javadocs错了,不过
Overrides the value defined
* by the container factory used to create the listener container.