javawebspherewildflyresource-adapter

How to configure auto reconnect of a MQ client in Wildfly resource adapter


I am using the resource adapter wmq.jakarta.jmsra.rar (version 9.3.3.1) and message driven beans in Wildfly to receive messages from an IBM MQ. When the MQ-server is disconnected (e.g. network problems), the connection is not reestablished. According to this documatation ( https://www.ibm.com/docs/en/ibm-mq/9.3.x?topic=adapter-configuration-resourceadapter-object-properties ) I added reconnectionRetryInterval and reconnectionRetryCount to my standalone.xml

<subsystem xmlns="urn:jboss:domain:resource-adapters:6.1">
        <resource-adapters>
            <resource-adapter id="wmq.jakarta.jmsra.rar">
                <archive>
                    wmq.jakarta.jmsra.rar
                </archive>
                <transaction-support>NoTransaction</transaction-support>
                <connection-definitions>
                    <connection-definition class-name="com.ibm.mq.jakarta.connector.outbound.ManagedConnectionFactoryImpl" jndi-name="java:jboss/jms/Isp4dQueueManager" tracking="false" pool-name="mqConnectionFactory">
                        <config-property name="hostName">
                            somehostname
                        </config-property>
                        <config-property name="port">
                            1234
                        </config-property>
                        <config-property name="transportType">
                            CLIENT
                        </config-property>
                        <config-property name="channel">
                            SomeChannel
                        </config-property>
                        <config-property name="queueManager">
                            SomeQueuemanager
                        </config-property>
                        <config-property name="username">
                            username
                        </config-property>
                        <config-property name="password">
                            password
                        </config-property>
                        <config-property name="reconnectionRetryCount">
                            30
                        </config-property>
                        <config-property name="reconnectionRetryInterval">
                            5000
                        </config-property>
                    </connection-definition>
                </connection-definitions>

As a result the following error appeared during startup

Caused by: org.jboss.jca.deployers.common.DeployException: IJ020060: Unable to inject: com.ibm.mq.jakarta.connector.outbound.ManagedConnectionFactoryImpl property: reconnectionRetryCount value: 30

So, what is the correct way to configure the reconnection behavior?


Solution

  • Turns out, that the config parameters have been at the wrong position. The following standalone.xml works

            <subsystem xmlns="urn:jboss:domain:resource-adapters:6.1">
                <resource-adapters>
                    <resource-adapter id="wmq.jakarta.jmsra.rar">
                        <archive>
                            wmq.jakarta.jmsra.rar
                        </archive>
                        <transaction-support>NoTransaction</transaction-support>
                        <config-property name="reconnectionRetryCount">
                            10
                        </config-property>
                        <config-property name="reconnectionRetryInterval">
                            900000
                        </config-property>
                        <connection-definitions>
                        ...