代码之家  ›  专栏  ›  技术社区  ›  Emman Sun

为什么simplejmsListenerContainerFactory不提供并发配置?

  •  0
  • Emman Sun  · 技术社区  · 8 年前

    我们可以看到 SimpleMessageListenerContainer 具有名为的属性 concurrentConsumers 但是 SimpleJmsListenerContainerFactory 不支持配置。根本原因是什么?不建议将并发用于 SimpleMessageListener容器 ?

    1 回复  |  直到 8 年前
        1
  •  0
  •   Gary Russell    8 年前

    在上设置并发 @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 &mdash; for example,
     * "5-10" &mdash; or a simple upper limit String &mdash; 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.