我有一个 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 个入站 channel 适配器。前 10 个连接到 ActiveMQ,但第 11 个从未连接。这些适配器的列出顺序无关紧要,第 11 个适配器始终会被忽略。服务适配器已初始化,但 channel 适配器从未连接到 ActiveMQ。
入站 channel 适配器的数量有限制吗?我可以在某处设置一个属性来更改此限制吗?
感谢您的帮助。
最佳答案
正确,有一个名为 TaskScheduler
的限制线程池大小10
:
http://docs.spring.io/spring-integration/reference/html/configuration.html#namespace-taskscheduler
因此,考虑使用 spring.integration.taskScheduler.poolSize
更改其大小使用属性(property)TaskExecutor
对于那些适配器将任务转移到其他线程并且不吃昂贵的TaskScheduler
.
还有其他方法:不要使用<int-jms:inbound-channel-adapter>
,但切换到 <int-jms:message-driven-channel-adapter>
,这是本质上的倾听,而且效果更好。
关于java - Spring 入站 channel 适配器的最大数量是多少?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38516234/