1

In my JavaEE application, I read messages from and IBM MQ queue in the following way:

 @TransactionAttribute(TransactionAttributeType.REQUIRED)
 public class MyMessageHandler implements MessageListener  {
 @Resource
 private MessageDrivenContext context;

 @Override
 public void onMessage(Message message) {
    try {
        processMessage(message);

    }
    catch (Exception e) {
        context.setRollbackOnly();
    }       
}

The application is deployed on Jboss EAP 6.4, and the wmq.jms.rar adapter ( Implementation-Version: 7.1.0.0-k000-L111005) is used. Here is the activation config from ejb-jar.xml:

<message-driven>
    <display-name>MyMessageHandler</display-name>
    <ejb-name>MyMessageHandler</ejb-name>
    <ejb-class>org.example.MyMessageHandler</ejb-class>
    <transaction-type>Container</transaction-type>
    <activation-config>
        <activation-config-property>
            <activation-config-property-name>hostName</activation-config-property-name>
            <activation-config-property-value>${somejbossproperty}</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
            <activation-config-property-name>port</activation-config-property-name>
            <activation-config-property-value>${somejbossproperty}</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
            <activation-config-property-name>channel</activation-config-property-name>
            <activation-config-property-value>${somejbossproperty}</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
            <activation-config-property-name>queueManager</activation-config-property-name>
            <activation-config-property-value>${somejbossproperty}</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
            <activation-config-property-name>transportType</activation-config-property-name>
            <activation-config-property-value>${somejbossproperty}</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
            <activation-config-property-name>username</activation-config-property-name>
            <activation-config-property-value>${somejbossproperty}</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
            <activation-config-property-name>password</activation-config-property-name>
            <activation-config-property-value>${somejbossproperty}</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
            <activation-config-property-name>destinationType</activation-config-property-name>
            <activation-config-property-value>javax.jms.Queue</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
            <activation-config-property-name>destination</activation-config-property-name>
            <activation-config-property-value>${somejbossproperty}</activation-config-property-value>
        </activation-config-property>
        <activation-config-property>
            <activation-config-property-name>acknowledgeMode</activation-config-property-name>
            <activation-config-property-value>auto-acknowledge</activation-config-property-value>
        </activation-config-property>
    </activation-config>
</message-driven>

When an exception is thrown, the transaction is rolled back, and the message is put into the IBM MQ backout queue using the IBM MQ backout mechanism. However, I notice a growth in the number of connections, and they are not released. This is how I monitor the number of connections on the IBM MQ server:

echo "display conn(*) all" | runmqsc <queue manager name> | grep <the IP of the Jboss server>| wc -l

Why can it happen?

gisly
  • 673
  • 1
  • 8
  • 30

1 Answers1

2

It seems that the issue was due to the version of the wmq.jms.rar-adapter. When we upgraded to a newer version (7.5.0.9-p750-009-180830), the connection leak stopped.

gisly
  • 673
  • 1
  • 8
  • 30
  • Can you provide the version that you were on that had a issue and the version that you upgraded to to solve the issue? – JoshMc Sep 17 '18 at 15:11
  • we had the issue with Implementation-Version: 7.1.0.0-k000-L111005.1 and we upgraded to Implementation-Version: 7.5.0.9-p750-009-180830 – gisly Sep 17 '18 at 16:04
  • Thank you for the update, but it would be preferred for people in the future to find this question and answer if you edit the question to put in the original problem version and edit the answer to state the version you upgraded to. I understand that when searching the comments are not searched. – JoshMc Sep 17 '18 at 20:35
  • Also note in general those are both out of support versions, 7.1 went out of support on April 30th 2017 and 7.5 went out of support on April 30th 2018 (7.5.0.9 was just released a few days ago and will be the last release for 7.5.0.9). You would be better off moving to v8.0 (this is announced end of support April 30th 2020), v9.0, or v9.1. – JoshMc Sep 17 '18 at 22:33
  • Btw, do I have to add some extra classes to the classpath for xa transaction support if I use v9 (for v7 we had to add com.ibm.mqetclient.jar (extended transactional client))? – gisly Sep 20 '18 at 08:23
  • 1
    It is now part of the base client so there should be nothing extra required. – JoshMc Sep 20 '18 at 08:48