Deploying 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.

Before you begin

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

About this task

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

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

Procedure

  1. Add the wmqJmsClient-2.0 feature to the server.xml file. If you want to perform a JNDI lookup, then you must also add the jndi-1.0 feature.
    <featureManager>
         <feature>wmqJmsClient-2.0</feature>
         <feature>jndi-1.0</feature>
    </featureManager>

    Adding 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 by using the shared memories or in BINDINGS mode to IBM MQ, you 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.
     <wmqJmsClient nativeLibraryPath="/opt/mqm/java/lib64"/>
    For z/OS platformsNote: To use the BINDINGS mode, the server must be configured with the zosTransaction-1.0 feature.