简体   繁体   中英

What is the maximum Spring inbound channel adapters?

I have a spring integration configuration file like:

<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>

There are 11 inbound-channel-adapter's. The first 10 connect to ActiveMQ, but the 11th one never does. It does not matter the order in which these adapters are listed, the 11th one always is ignored. The service adapter is initialized, but the channel adapter never connects to ActiveMQ.

Is there a limit to the number of inbound channel adapters? Is there a property that I can set somewhere that changes this limit?

Thanks for your help.

Correct, there is limit called TaskScheduler thread pool with size 10 :

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

So, consider to change its size with spring.integration.taskScheduler.poolSize property, of use TaskExecutor for those adapters to shift tasks to other threads and don't eat expensive TaskScheduler .

There is other approach: don't use <int-jms:inbound-channel-adapter> , but switch to <int-jms:message-driven-channel-adapter> , which is listening by nature and much better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM