0

I have a spring integration application with a requirement of 2 DefaultMessageListenerContainer (with transactionManager) and 2 jms:outbound-channel-adapter.

I have configured each listener container with "property name="connectionFactory" ref="jmsConnectionFactory" and also "property name="transactionManager" ref="platformTransactionManager" .

But for the transaction manager i have used again a different jmsConnectionFactory . I am not using a CachingConnectionFactory in the listener container but using it in platformTransactionManager . For jms:outbound-channel-adapter again i am using the same jmsConnectionFactory which i have used in listener container.

My problem is that with this configuration i am hitting the no. of connections exceeding the limit (150) to a MQ channel in a high load condition.

I tried many different ways but i don't see the no. of connection getting down once it gets up , using below configuration for cachingFactory

CachingConnectionFactory cachingConnectionFactory = new 
CachingConnectionFactory(factory);
    cachingConnectionFactory.setCacheConsumers(true);
    cachingConnectionFactory.setCacheProducers(true);
    cachingConnectionFactory.setSessionCacheSize(16);`

i tried

1)sharing the jmsConnectionFactory between the listenerContainer and the platformTransactionManager but the txn doesn't work correctly as i see the messages getting sent in incorrect order

2)using the cachingConenctionFactory in thelistenerContainer` , but still i see the same no. of connections

Should i use 3 different jmsConnectionFactory for the listener, txnmanager and the sender?

What would be best configuration here, please suggest , many thanks!

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118

1 Answers1

0

I think with IBM MQ you can't use CachingConnectionFactory, but instead this one as:

<bean id="connectionFactory" class="org.springframework.jms.connection.DelegatingConnectionFactory">
    <property name="targetConnectionFactory" ref="imbMqFactory"/>
    <property name="shouldStopConnections" value="true"/>
</bean>

This single connectionFactory must be used from the TX manager and from the containers.

Artem Bilan
  • 113,505
  • 11
  • 91
  • 118