ConcurrentConsumers for ActiveMQ Queue

I am trying to use messages from an ActiveMQ queue in grails. I have configured several spring beans to connect, and so far everything is working fine.

The problem starts when I try to set concurrentConsumers above 8. It seems that 8 is installed as a maximum for one client - if I configure more than 8, 8 consumers for the queue are still displayed in ActiveMQ Explorer. If I configure two listeners for different queues with more than 8 concurrentConsumers , the number of consumers shown by ActiveMQ oszillate, but the sum is always 8.

What am I doing wrong? Configuration examples show concurrentConsumers up to 50 ...

Here is my configuration written as groovy DSL, I think it is not a problem to read it ...

 jmsFactory(org.apache.activemq.pool.PooledConnectionFactory) { bean -> bean.destroyMethod = "stop" connectionFactory = { org.apache.activemq.ActiveMQConnectionFactory cf -> brokerURL = "tcp://localhost:61616" } } jmsTemplate(org.springframework.jms.core.JmsTemplate) { connectionFactory = jmsFactory } jmsMessageListener(org.springframework.jms.listener.adapter.MessageListenerAdapter, ref("messageService")) { defaultListenerMethod = "onMessage" } jmsContainer(org.springframework.jms.listener.DefaultMessageListenerContainer) { connectionFactory = jmsFactory concurrency="10" concurrentConsumers="15" destinationName = "demoQueue" messageListener = jmsMessageListener transactionManager = ref("transactionManager") autoStartup = false } jmsMessageListener2(org.springframework.jms.listener.adapter.MessageListenerAdapter, ref("messageService")) { defaultListenerMethod = "onMessage2" } jmsContainer2(org.springframework.jms.listener.DefaultMessageListenerContainer) { connectionFactory = jmsFactory destinationName = "demoQueue2" messageListener = jmsMessageListener2 transactionManager = ref("transactionManager") autoStartup = false } 
+4
source share
1 answer

Since Petter pointed out that this might not be an ActiveMQ or Spring configuration issue, I created a Spring user in java and tried to find the difference with my grails consumer.

The java user works as expected, but does not use the transaction manager. So I removed the transaction manager from my grails confid and it works!

Then I searched googled a bit and found a hint for the cacheLevel parameter: http://static.springsource.org/spring/docs/2.0.8/api/org/springframework/jms/listener/DefaultMessageListenerContainer.html#setCacheLevel%28int%29

When using the transaction manager, cacheLevel doesn't matter - bingo! If I now set cacheLevel to CACHE_CONSUMER, everything will work as expected ...

+1
source

All Articles