Liberty Java Message Service (JMS) Client Sample

The JMS sample contains a server definition which includes the features for running only JMS client application without creating a messaging engine(wasJmsClient-1.1). This JMS application connects remotely to a messaging engine running in a different Liberty Profile. This sample also contains MDB feature (jmsMdb-3.1). It also contains a very simple JMS application, JMSSample.war, which contains couple of servlet for performing Point to Point and Publish/Subscribe messaging.The JMS Servlet provides means to send/receive messages to a queue and also publish and subscribe messages from a Topic. For each of the function, servlet logs the appropriate logs into the console.log

Note that to run this sample, you will need to start the JMSSampleServer.

This sample can be installed onto runtime versions 8.5.5.0 and later.

Installation Instructions

Online installation (requires 8.5.5.6 or later):

  1. Install the sample by running the command below from the bin directory of your server installation:
    installUtility install JMSSampleClient

Any missing features required by the server will be installed for you.

Offline installation:

  1. Download the JMSSampleClient.jar using the download button at the top of the page and place it in the root of your server installation.
  2. Extract the sample into the Liberty installation by running the command below from the root of your server installation:
    java -jar JMSSampleClient.jar

Any missing features required by the server will need to be installed separately.

Running The Application

To run the JMSApp application:

  1. Start the JMSSampleClient server by running the command below from the bin directory in the Liberty profile installation:
    server run JMSSampleClient
  2. Confirm the application started by looking for the following message in the log:
    CWWKZ0001I: Application JMSApp started in XX.XX seconds.
  3. In your browser, enter the URL for the application (see notes for other actions):
    For Point to Point (P2P) - http://localhost:9128/JMSApp/JMSSampleP2P?ACTION=SendMessage 
    For Publish Subscribe (Pub/Sub) - http://localhost:9128/JMSApp/JMSSamplePubSub?ACTION=NonDurableSubscriber 
    (where 9128 is the HTTP endpoint on which the JMSSample servlet is running).
  4. Once you run the above link you should see a completion message on the Web browser.

Notes

If you want to know the list of supported actions for P2P enter http://localhost:9128/JMSApp/JMSSampleP2P?ACTION=ListActions for PubSub enter http://localhost:9128/JMSApp/JMSSamplePubSub?ACTION=ListActions.

The JMSApp.war file contains the source and binaries for the application, and can be used to import it to Eclipse.

Sample Structure

  • wlp
    • usr
      • servers
        • JMSSampleClient
          • Copyright.txt
          • dropins
            • JMSApp.war
          • readme.html
          • server.xml