1

I want to concurrently listen the messages(Plenty of messages) from Queue using Spring's DefaultMessageListenerContainer.

<bean id="jmsContainer" class="org.springframework.jms.listener.DefaultMessageListenerContainer">
    <property name="connectionFactory" ref="connectionFactory"/>
    <property name="destinationName" ref="queue"/>
    <property name="messageListener" ref="myMessageListener"/>
    <property name ="concurrentConsumers" value ="10"/>
    <property name ="maxConcurrentConsumers" value ="10000"/>        
</bean> 

I read from the spring_Forum that max 5 to 10 concurrentConsumers can be specified in concurrentConsumers and maxConcurrentConsumers. .

Question 1 :

I want to read too many messages as fast as possible.

Can it be possible by increasing the concurrentConsumers & maxConcurrentConsumers to 10 thousand or more than that?

Question 2:

Please suggest any other way If it is not efficient way for the too many messages?

Assuming, Threads(Equal to maxConcurrentConsumers) running in system is going to start thrashing as it madly context switches between all the running processes (Threads).

Alagammal P
  • 829
  • 5
  • 19
  • 43

1 Answers1

0

The optimal number of threads that would process the messages depend on the actual work they are going to do, this is a general topic not directly related to JMS, see for example here.

Possible optimizations related to the JMS itself are first of all connection and session caching. See this discussion. Another way is dropping persistence if you can afford this.

Alexander
  • 2,761
  • 1
  • 28
  • 33