Through the WebSphere® MQ messaging
provider in the Liberty profile, Java™ Message
Service (JMS) messaging applications can use your WebSphere MQ system as an external
provider of JMS messaging resources.
Before you begin
You must ensure that a Liberty profile server is created
on which you want to deploy the messaging application that uses JMS.
For more information, see Creating a Liberty profile server manually.
About this task
The wmqJmsClient-1.1 feature
provides support for applications that use Java Messaging Service 1.1 specifications.
Procedure
- Add the wmqJmsClient-1.1 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-1.1</feature>
<feature>jndi-1.0</feature>
</featureManager>
Adding the wmqJmsClient-1.1 feature
enables the Liberty server to load the necessary WebSphere MQ bundles that will
enable you to define the WebSphere MQ JMS
resources. For example, the connection factory and activation specification
properties provide client libraries to connect to the WebSphere MQ network.
- Specify the location of the WebSphere 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 WebSphere MQ Resource
Adapter file,
wmq.jmsra.rar.
For details of the supported versions, and how
to obtain the wmq.jmsra.rar file and install
it, refer to the WebSphere MQ
technote 1633761, Obtaining the WebSphere MQ
Resource Adapter for the WebSphere Application
Server Liberty Profile.
- 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>
- Configure JMS applications to connect in the BINDING mode.
In order to allow the JMS applications to connect by using
the shared memories or in BINDING mode to
WebSphere MQ, you must have both
the Liberty profile and
WebSphere MQ deployed
on the same server. To allow JMS applications to connect in BINDING
mode, use the <nativeLibraryPath> element in the
server.xml file
to specify the location of the
WebSphere MQ native libraries.
<wmqJmsClient nativeLibraryPath="/opt/mqm/java/lib64"/>