Deploy JMS applications to Liberty to use the IBM MQ messaging provider

Through the IBM MQ messaging provider in Liberty, Java Message Service (JMS) messaging applications can use your IBM MQ system as an external provider of JMS messaging resources.

We must ensure that a Liberty server is created on which we want to deploy the messaging application that uses JMS. For more information, see Create a Liberty server manually.

The wmqJmsClient-2.0 feature provides support for applications that use JMS 2.0 specifications.

Note that the wmqJmsClient-2.0 feature supports the features of both JMS 1.1 and JMS 2.0 specifications. However, we can choose to use the wmqJmsClient-1.1 feature to use only the features that are compliant with JMS 1.1 specification.

  1. Add the wmqJmsClient-2.0 feature to the server.xml file. To perform a JNDI lookup, then we must also add the jndi-1.0 feature.

      <featureManager>
           <feature>wmqJmsClient-2.0</feature>
           <feature>jndi-1.0</feature>
      </featureManager>

    Add the wmqJmsClient-2.0 feature enables the Liberty server to load the necessary IBM MQ bundles that enable you to define the IBM MQ JMS resources. For example, the connection factory and activation specification properties provide client libraries to connect to the IBM MQ network.

  2. Specify the location of the IBM MQ Resource Adapter by adding the following entry to the server.xml file:

      <variable name="wmqJmsClient.rar.location" value="/path/to/wmq/rar/wmq.jmsra.rar"/>

    where the value attribute specifies the absolute path to the IBM MQ Resource Adapter file, wmq.jmsra.rar.

    For details about the supported versions and obtaining the wmq.jmsra.rar file, refer to the IBM MQ resource adapter for Liberty information. Obtain the wmq.jmsra.rar file and install it from Fix central.

  3. Add the connection factory definitions to the server.xml file.

      <jmsConnectionFactory jndiName="jms/wmqCF" connectionManagerRef="ConMgr6">
           <properties.wmqJms 
              transportType="CLIENT"
              hostName="localhost" 
              port="1414"
              channel="SYSTEM.DEF.SVRCONN"
              queueManager="QM1"/>
      </jmsConnectionFactory>
      <connectionManager id="ConMgr6" maxPoolSize="2"/>
      
      <jmsQueue id="jms/queue1" jndiName="jms/wmqQ1">
           <properties.wmqJms 
              baseQueueName="MDBQ" 
              baseQueueManagerName="QM1"/>
          </jmsQueue>

  4. Configure JMS applications to connect in the BINDINGS mode. To allow the JMS applications to connect using the shared memories or in BINDINGS mode to IBM MQ, we must have both Liberty and IBM MQ deployed on the same server. To allow JMS applications to connect in BINDINGS mode, use the nativeLibraryPath element in the server.xml file to specify the location of the IBM MQ native libraries.

    Note: To use the BINDINGS mode, the server must be configured with the zosTransaction-1.0 feature.