Note that there are some explanatory texts on larger screens.

plurals
  1. POHow to concurrently process spring integration jms channels
    primarykey
    data
    text
    <p>I've got a JMS connectionFactory that a number of spring integration jms inbound-gateways use. They work fine, but only one message at a time. I'd like to make them handle N concurrent messages at a time in different threads. </p> <p>The code I've got now is as follows.</p> <p>spring-config.xml</p> <pre><code>&lt;import resource="commons/jmsConnectionFactory.xml"/&gt; &lt;import resource="chain/chain1.xml"/&gt; &lt;import resource="chain/chain2.xml"/&gt; </code></pre> <p>jmsConnectionFactory.xml</p> <pre><code>&lt;bean id="connectionFactory" class="org.apache.activemq.ActiveMQConnectionFactory"&gt; &lt;property name="brokerURL"&gt; &lt;value&gt;failover:(tcp://mqmaster:61616,tcp://mqslave:61616)?jms.prefetchPolicy.all=1&amp;amp;randomize=false&lt;/value&gt; &lt;/property&gt; &lt;/bean&gt; </code></pre> <p>chains all look something like this</p> <pre><code>&lt;int:channel id="fooChannel"/&gt; &lt;int-jms:inbound-gateway request-channel="fooChannel" request-destination-name="foo" extract-request-payload="true" /&gt; &lt;int:chain input-channel="fooChannel"&gt; &lt;int-http:outbound-gateway url="...." http-method="GET" extract-request-payload="true" /&gt; &lt;int:object-to-string-transformer /&gt; &lt;/int:chain&gt; </code></pre> <p>I know that I can add "concurrent-consumers" and "max-concurrent-consumers" to the inbound-gateway to make the gateway process multiple messages. That would result though in having each chain/gateway handling it's threads managed independently. I would like some way to define a common thread pool for everyone using the JMS connection. This would allow me to specify 5 threads and have them allocated among the gateways based on what messages the server is supplying, but constraining the consuming server to a manageable amount of work.</p> <p>What modifications are needed to do the processing with multiple threads? And how do I limit the number of threads?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload