Uploaded image for project: 'Spring Integration'
  1. Spring Integration
  2. INT-1948

Add cacheLevel property for jms:message-driven-channel-adapter configuration

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor
    • Resolution: Complete
    • Affects Version/s: None
    • Fix Version/s: 2.0.5
    • Component/s: None
    • Labels:
      None

      Description

      The jms:message-driven-channel-adapter doesn't have a cacheLevel configuration and once we set the
      transactionManager the cacheLevel will be CACHE_NONE (See the DefaultMessageListenerContainer.initialize() method).
      This will have a huge performance impact, when trying to have a JTA environment with both DB and JMS queues.

      For the current project I am working on, when I configured all the DataSources/ConnectionFactories to use a
      transactionManager it took a very long time to fetch messages from the JMS queue.

      After I replaced the jms:message-driven-channel-adapter from

      <jms:message-driven-channel-adapter id="imageProcessingInputResponseAdapter"
                                              connection-factory="jmsConnectionFactory"
                                              destination="imageProcessingInputQueue"
                                              channel="imageProcessingInputResponseChannel"
                                              error-channel="errorChannel"
                                              concurrent-consumers="${jms.concurrent.consumers}"/>
      

      to

      <bean id="imageProcessingInputResponseAdapterEndpoint"
                class="org.springframework.integration.jms.JmsMessageDrivenEndpoint">
              <constructor-arg name="listenerContainer">
                  <bean class="org.springframework.jms.listener.DefaultMessageListenerContainer">
                      <property name="connectionFactory" ref="jmsConnectionFactory"/>
                      <property name="destination" ref="imageProcessingInputQueue"/>
                      <property name="transactionManager" ref="dtfCoreTransactionManager"/>
                      <property name="cacheLevel" value="3"/>
                      <property name="concurrentConsumers" value="${jms.concurrent.consumers}"/>
                  </bean>
              </constructor-arg>
              <constructor-arg name="listener">
                  <bean class="org.springframework.integration.jms.ChannelPublishingJmsMessageListener">
                      <property name="requestChannel" ref="imageProcessingInputResponseChannel"/>
                      <property name="errorChannel" ref="errorChannel"/>
                  </bean>
              </constructor-arg>
          </bean>
      

      only to set the cacheLevel.

        Attachments

          Activity

            People

            • Assignee:
              oleg.zhurakousky@springsource.com Oleg Zhurakousky
              Reporter:
              mih_vlad MIhalcea Vlad
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: