Nav
You are viewing an older version of this section. Click here to navigate to the latest version.

WebSphere MQ Example

Enterprise Edition

The WebSphere MQ example demonstrates how to use the WebSphere MQ transport  to send and receive transactional messages to WebSphere MQ. This example is available in Mule Enterprise Edition.

Assumptions

This document assumes that you are familiar with Mule ESB. For an overview of basic operations, such as starting the server and locating Mule files, consult the Quick Start Guide to Mule ESB Server and the Management Console.

Prerequisites

Before you run the example, ensure that your system meets the following conditions:

  • Mule Enterprise 3.1 or later is installed

  • WebSphere MQ 6 or 7 is installed

  • The WebSphere MQ client JARs are available to you

Set Up

As with this WebSphere MQ example, you can create template applications straight out of the box in Mule Studio or Mule Standalone (Mule ESB without Studio). You can tweak the configurations of these use case-based templates to create your own customized applications in Mule.

Follow the procedure below to create, then run the Websphere MQ application in Mule ESB.

  1. Complete the procedure in Examples and Exercises to create WebSphere MQ template in Mule Studio, or the WebSphere MQ example in Mule Standalone (Mule ESB without Studio). Create, but do not run the application.

  2. Add your WebSphere MQ client libraries to the project build path.

  3. Make sure your WebSphere MQ installation has queues named "in" and "out."

  4. Start the application by following Step 8 in Examples and Exercises. When the application starts you may see some exceptions in the output console, since WMQ is not configured (we will configure it in the next step).

  5. Edit the following properties in wmq.properties (located at src/main/resources) with the values appropriate for your WebSphere MQ installation:

    
                
             
    1
    2
    3
    4
    5
    
    wmq.host=
    wmq.port=
    wmq.queue.manager=
    wmq.username=
    wmq.password=

    After configuring WMQ, restart the application.

With Mule Standalone

  1. Copy your WebSphere MQ client JARs to your $MULE_HOME/lib/user directory.

  2. Ensure that your WebSphere MQ installation has queues named "in" and "out."

  3. Copy the example’s zip file, <MULE_HOME>/examples/wmq/mule-example-wmq-3.3.1.zip to the $MULE_HOME/apps directory.

  4. Start Mule, then wait for it to install the example. You may see some exceptions in the logs, since WMQ is not configured yet (we will configure it in the next step).

  5. Edit the following properties in the file <`MULE_HOME>/apps/mule-example-wmq/classes/wmq.properties` with the values appropriate for your Websphere MQ installation:

    
                 
              
    1
    2
    3
    4
    5
    
    wmq.host=
    wmq.port=
    wmq.queue.manager=
    wmq.username=
    wmq.password=

After configuring WMQ, restart Mule or reload the application.

<MULE_HOME> is the root directory of your Mule installation, for example /opt/Mule/mule-standalone-3.3.1.

How to start the Mule server

check There are several ways to start/stop the Mule server: * Using the Mule Management Console, which provides a graphical interface for managing servers * Using the command line Generally, the simplest way to start the server is by using the command line: * On a Linux/Unix system, run the following command: On a Windows system, go to the <MULE_HOME>\bin by running the following command: .How to reload the Websphere MQ app without restarting Mule (Unix) check If you modify the Websphere MQ application while Mule is running, you can reload the application without restarting Mule by "touching" (updating the timestamps of) the file <MULE_HOME>/apps/mule-example-bookstore-3.3.1/mule-config.xml. To update the timestamps, run the following command: Mule automatically reloads the application, activating any modifications.