Announcement Announcement Module
No announcement yet.
Spring DMLC, cacheLevel and message receive Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Spring DMLC, cacheLevel and message receive

    I am using Spring DefaultMessageListenerContainer for managing queue consumers. Here is the simple configuration for DMLC:

    <bean id="listenerContainer"
    class="org.springframework.jms.listener.DefaultMes sageListenerContainer">

    <property name="concurrentConsumers"><value>1</value></property>
    <property name="connectionFactory" ref="pooledConnectionFactory"/ >
    <property name="destination" ref="destination" />
    <property name="messageListener" ref="messageListener" />
    <property name="transactionManager" ref="jmsTransactionManager" />
    <property name="cacheLevelName" value="CACHE_CONSUMER"/>

    <bean id="pooledConnectionFactory"
    class="org.apache.activemq.pool.PooledConnectionFa ctory"
    <property name="connectionFactory" ref="connectionFactory"></property>
    <property name="maxConnections"><value>10</value></property>

    <bean id="connectionFactory"
    class="org.apache.activemq.ActiveMQConnectionFacto ry">
    <property name="brokerURL"><value>${brokerUrl}</value> </property>
    <property name="prefetchPolicy">
    <bean id="prefetchPolicy" class="org.apache.activemq.ActiveMQPrefetchPolicy" >
    <property name="all" value="1000"/>

    <bean id="jmsTransactionManager"
    class="org.springframework.jms.connection.JmsTrans actionManager">
    <property name="connectionFactory" ref="pooledConnectionFactory" />

    Everything seems to be working under heavy load (say 100 msg/sec from sender) as long as cacheLevel is set to CACHE_CONSUMER. But if I set cacheLevel to CACHE_SESSION then consumer is unable to receive messages. Many a times, it simply hangs after receiving 5-10% of total messages in the queue (say we sent 4000 messages of size 20 bytes each) and rest of the messages are pending with broker (ActiveMQ in this case)

    As per spring documentation on cache level, with CACHE_SESSION it caches connection as well as session. So i am just wondering, why should consumer hang (or don't receive all the messages) with cache level as CACHE_SESSION. Put it other way with CACHE_CONSUMER as cache level, does caching of JMS message consumer has this much impact on overall message handling as consumer side.

    If you have come across this issue or have pointers to look in this direction , please share.

    Version details:
    spring 2.5.3
    ActiveMQ: 5.1.0