为什么 SimpleJmsListenerContainerFactory 没有提供并发配置?
Why SimpleJmsListenerContainerFactory did NOT provide concurrency config?
我们可以看到 SimpleMessageListenerContainer
有 属性 命名为 concurrentConsumers
,但是 SimpleJmsListenerContainerFactory
不支持配置它。根本原因是什么?不建议 SimpleMessageListenerContainer
?
使用并发
在 @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 "";
不过看起来 Javadoc 是错误的
Overrides the value defined
* by the container factory used to create the listener container.
我们可以看到 SimpleMessageListenerContainer
有 属性 命名为 concurrentConsumers
,但是 SimpleJmsListenerContainerFactory
不支持配置它。根本原因是什么?不建议 SimpleMessageListenerContainer
?
在 @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 "";
不过看起来 Javadoc 是错误的
Overrides the value defined
* by the container factory used to create the listener container.