To deploy messaging applications that use the Java™ Messaging Service (JMS), you must add the wasJmsServer-1.0 and wasJmsClient-2.0 features
to the server.xml file, and define the connection
factory and destination properties. If you want to perform a JNDI
lookup, then you must add the jndi-1.0 feature along
with the other two features.
Before you begin
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.
Important: The wasJmsClient-2.0 feature supports the features of both JMS 1.1 and JMS 2.0 specifications. However, you can choose to use the wasJmsClient-1.1 feature if you want to use only the features that are compliant with JMS 1.1 specification.
About this task
The wasJmsServer-1.0 feature
provides support for applications that use Java Messaging Service 1.1 specifications.
Procedure
- Add the wasJmsServer-1.0, wasJmsClient-2.0,
and jndi-1.0 features to the server.xml file.
<featureManager>
<feature>wasJmsServer-1.0</feature>
<feature>wasJmsClient-2.0</feature>
<feature>jndi-1.0</feature>
</featureManager>
- Add the destination definitions to the server.xml file.
<messagingEngine>
<queue id="QUEUE1"> </queue>
</messagingEngine>
- Optional: Add the <wasJmsEndpoint> element
to enable the JMS messaging engine to accept the remote incoming messaging
connections from TCP/IP (with and without SSL).
<wasJmsEndpoint
host="*"
wasJmsPort="7276"
wasJmsSSLPort="9100">
</wasJmsEndpoint>
Note: Adding <wasJmsEndpoint> is optional. By default, the Liberty server enables messaging engine to listen
on 7276 port (unsecured) and 7286 (secured). If you want to specify a different port, then
<wasJmsEndpoint> can be configured.
- Add the connection factory definitions to the server.xml file.
- For Point-to-Point domain:
<jmsQueueConnectionFactory jndiName="jndi_JMS_BASE_QCF">
<properties.wasJms
remoteServerAddress="localhost:7276:BootStrapBasicMessaging" />
</jmsQueueConnectionFactory>
<jmsQueue jndiName="jndi_INPUT_Q">
<properties.wasJms queueName="QUEUE1" />
</jmsQueue>
- For Publish-Subscribe domain:
<jmsTopicConnectionFactory jndiName="eis/tcf">
<properties.wasJms
clientID="defaultID" />
</jmsTopicConnectionFactory>
<jmsTopic jndiName="eis/topic1">
<properties.wasJms topicName="Football" />
</jmsTopic>
The JMS applications are now connected to
the embedded messaging server.