【问题标题】:What is the maximum Spring inbound channel adapters?Spring 入站通道适配器的最大数量是多少?
【发布时间】:2016-07-22 09:15:00
【问题描述】:

我有一个 spring 集成配置文件,例如:

<int-jms:inbound-channel-adapter
        channel="fromjmsRecon"
        jms-template="jmsTemplate"
        destination-name="com.mycompany.inbound.recon">
    <int:poller fixed-delay="3000" max-messages-per-poll="1"/>
</int-jms:inbound-channel-adapter>
<int:publish-subscribe-channel id="fromjmsRecon"/>
<int:service-activator input-channel="fromjmsRecon"
                       ref="processInboundReconFile"
                       method="execute"/>

... 10 More inbound channels ...

<int-jms:inbound-channel-adapter
        channel="fromjmsVanRecon"
        jms-template="jmsTemplate"
        destination-name="com.mycompany.inbound.another">
    <int:poller fixed-delay="3000" max-messages-per-poll="1"/>
</int-jms:inbound-channel-adapter>
<int:publish-subscribe-channel id="fromjmsVanRecon"/>
<int:service-activator input-channel="fromjmsVanRecon"
                       ref="processInboundAnother"
                       method="execute"/>

</beans>

有 11 个入站通道适配器。前 10 个连接到 ActiveMQ,但第 11 个从不连接。这些适配器的列出顺序无关紧要,第 11 个总是被忽略。服务适配器已初始化,但通道适配器从未连接到 ActiveMQ。

入站通道适配器的数量是否有限制?我可以在某处设置一个属性来更改此限制吗?

感谢您的帮助。

【问题讨论】:

    标签: java spring jms spring-integration


    【解决方案1】:

    正确,有一个称为TaskScheduler 的线程池大小为10 的限制:

    http://docs.spring.io/spring-integration/reference/html/configuration.html#namespace-taskscheduler

    因此,考虑使用spring.integration.taskScheduler.poolSize 属性更改其大小,使用TaskExecutor 让那些适配器将任务转移到其他线程并且不要吃昂贵的TaskScheduler

    还有其他方法:不要使用&lt;int-jms:inbound-channel-adapter&gt;,而是切换到&lt;int-jms:message-driven-channel-adapter&gt;,它天生就是,而且效果更好。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2012-12-17
      • 1970-01-01
      • 2014-06-29
      • 1970-01-01
      • 2023-03-12
      • 1970-01-01
      • 2015-07-11
      • 2013-02-02
      相关资源
      最近更新 更多