Atomikos Forum

IBM MQSeries Session overflow

Spring-batch + Atomikos 3.4.4 + MQSeries 6.0.2

I have to put messages on a queue and write them on a database in the same transaction. But I encountered a problem when I try to send more than a certain number of messages. I have debugged it and found that MQSessions are never closed. Somehow they remain opened.
I think it's the same problem as here
http://www.atomikos.org/forums/viewtopic.php?p=612&highlight=severity&sid=8d4c0258fa4a33ce595049ac4a480359

here is my configuration:

    
    <!--  IBM MQSeries ConnectionFactory/Destination/CredentialsConnection to use -->
     <bean id="MqConnectionFactory" class="com.ibm.mq.jms.MQXAQueueConnectionFactory">
          <property name="queueManager">
                  <value>${connection.factory.queueManager}</value>
          </property>
          <property name="hostName">
              <value>${connection.factory.hostName}</value>
          </property>
          <property name="port">
              <value>${connection.factory.port}</value>
          </property>
          <property name="transportType" value="${connection.factory.transportType}"/>
          <property name="channel" value="${connection.factory.channel}"/>
    </bean>
    
    <!-- Atomikos ConnectionFactory -->
    <bean name="atomikosConnectionFactory"
        class="com.atomikos.jms.AtomikosConnectionFactoryBean" destroy-method="close">
        <property name="xaConnectionFactory" ref="MqConnectionFactory" />
        <property name="uniqueResourceName" value="My_MQSeries_XA_RMI" />
        <property name="maintenanceInterval" value="1" />
        <property name="maxIdleTime" value="5" />
        <property name="maxPoolSize" value="200" />
        <property name="localTransactionMode" value="false" />
    </bean>
        
    <bean id="destination" class="com.ibm.mq.jms.MQQueue">
        <property name="baseQueueManagerName" value="${queue.base.queue.manager.name}"/>
        <property name="baseQueueName" value="${queue.base.queue.name}"/>
    </bean>
   
    <bean id="jmsFactory" class="org.springframework.jms.connection.UserCredentialsConnectionFactoryAdapter">
        <property name="targetConnectionFactory" ref="atomikosConnectionFactory"/>
        <property name="username" value="${connection.factory.adapter.username}"/>
        <property name="password" value="${connection.factory.adapter.password}"/>
    </bean>          
 
    
    <!-- Spring JMS Template -->
    
    <bean id="myJmsTemplate"    class="org.springframework.jms.core.JmsTemplate">
        <property name="connectionFactory">
            <bean class="org.springframework.jms.connection.SingleConnectionFactory">
                <property name="targetConnectionFactory" ref="jmsFactory" />
            </bean>
        </property>
        <property name="defaultDestination" ref="destination" />
        <property name="sessionTransacted" value="true"/>
    </bean>
    
    <bean id="headerMapper" class="com.mycompany.pub.channel.jms.DefaultJmsHeaderMapper">
    </bean>

    <bean id="jmsEndPointTarget" class="com.mycompany.pub.channel.jms.JmsEndPointTarget">
        <property name="jmsTemplate">
            <ref bean="myJmsTemplate"></ref>
        </property>

        <property name="destination">
            <ref bean="destination" />
        </property>
        <property name="headerMapper">
            <ref bean="headerMapper"/>
        </property>
    </bean>
    
</beans>
lam7a Send private email
Friday, December 05, 2008
 
 
Hi,

If it _is_ the same bug as the one you found then it will work with the deprecated factories (since that bug was definitely fixed in there).

So: to test if this is a resurrected problem, could you try the experiment with our old connection factory? It is in the transactions-jms-deprecated jar. 

Thanks
Guy
Guy Pardon Send private email
Saturday, December 06, 2008
 
 
Hi Guy,

Thanks for the answer.
Unfortunately, it doesn't work, neither with QueueConnectionFactoryBean nor AtomikosConnectionFactoryBean.

what I changed is this:

<bean name="atomikosConnectionFactory"
      class="com.atomikos.jms.QueueConnectionFactoryBean">
    <property name="xaQueueConnectionFactory"
        ref="MqConnectionFactory" />
    <property name="resourceName" value="MQSeries_XA_RMI"/>
</bean>


For the first configuration I posted, I used transactions-essentials-all.jar, and I also tried with the separated jars using transactions-jms-deprecated.jar.

Is there anything else I have to check?

Thanks.
lam7a Send private email
Thursday, December 11, 2008
 
 
Hi,

The Spring JMSTemplate opens a new connection/session for each send. So if you send a lot in ONE transaction then these sessions will have to stay open due to the XA protocol (termination is done on the session!).

You can be more efficient if you use our SenderTemplate class in com.atomikos.jms.extra package.

Let me know if that helps,
Guy
Guy Pardon Send private email
Thursday, December 11, 2008
 
 
Hi,

Thank you Guy, now it works with the SingleThreadedJmsSenderTemplate instead of using the Spring JMSTemplate.

Cheers,
lam7a Send private email
Friday, December 19, 2008
 
 

This topic is archived. No further replies will be accepted.

Other recent topics Other recent topics