• No results found

WebSphere MQ configuration

In document Enabling SOA Using WebSphere Messaging (Page 124-132)

Chapter 5. Point-to-point runtime configuration

5.1 WebSphere MQ configuration

This section gives an overview of the elements required in WebSphere MQ to receive and deliver messages. It covers the basics of creating queue managers and queues, and connecting one queue manager to another. If you are not familiar with WebSphere MQ concepts, review “WebSphere MQ” on page 28. To illustrate, let us assume that an application wants to input data to node 1 and another application wants to get the data from node 2. Assured data delivery is a requirement.

First we need a queue manager on each node. QM1 will be created on node 1 and QM2 on node 2. In QM1, we have to define a remote queue definition, sender channel, and transmission queue. In QM2, we have to define target queue, receiver channel, and listener. This configuration is shown in Figure 5-1.

Figure 5-1 WebSphere MQ - WebSphere MQ integration

Note that in this configuration the following is true:

򐂰 The MQLINK queue in QM1 is a remote queue definition pointing to the TARGET queue in QM2.

򐂰 QM2 queue in QM1 is a transmission queue.

򐂰 There is a pair of sender and receiver channels between the two queue managers.

When application APP1 puts XML data on the MQLINK queue, the data is delivered through the channel. Application APP2 gets the XML data from the TARGET queue.

The steps required to create and test the connection are: 1. Create the queue managers.

2. Create a remote queue definition. 3. Create a transmission queue. 4. Create a sender channel. 5. Create a local queue. 6. Create a receiver channel. 7. Start the sender channel. 8. Test the connection.

The next sections illustrate how this is done for our example. These steps are performed using the WebSphere MQ Explorer tool. For testing purposes, we used one machine and one installation of WebSphere MQ, and thus one instance of WebSphere MQ Explorer. As you go through this example, keep in mind that under normal circumstances you would be creating a connection between two machines and two instances of WebSphere MQ.

5.1.1 Create the queue managers

Let us start our configuration by creating the new queue managers using the WebSphere MQ Explorer. In the Explorer window:

1. Right-click Queue Managers and select New Queue Manager.

2. In Step 1, type QM1 in the Queue Manager Name field and click Next. 3. In Step 2, take the default for the log values and select Next.

4. In Step 3, deselect Auto Start Queue Manager, and select Next.

5. In Step 4, enter the listener port number. The default is 1414. If you already have a queue manager running on the system you will need to select a different port number.

6. Click Finish.

Create QM2 using the same process. Since we used one machine we needed to use a different listener port number (1415) in step 4.

5.1.2 Create a remote queue definition

Next, we need a remote queue definition in QM1 to point to the TARGET queue that resides (or will reside) in QM2.

1. Navigate to Queue Managers QM1 Queues.

2. Right-click Queues.

3. Select New Remote Queue Definition.

4. Type MQLINK in the Name field, and click Next.

5. Type TARGET in Remote Queue field and QM2 in the Remote Queue Manager field (Figure 5-3).

Figure 5-3 Create a remote queue definition

5.1.3 Create a transmission queue

A transmission queue is a local queue on which prepared messages destined for a remote queue manager are temporarily stored. To create the transmission queue:

1. Navigate to Queue Managers QM1 Queues.

2. Right-click Queues.

3. Select New Local Queue.

4. Type QM2 in the Name field and click Next.

5. Change the Usage field to Transmission and click Finish.

Figure 5-4 Create a transmission queue

When you are done, you will see the that there are two queues in QM1. The remote queue definition, MQLINK, and the transmission queue, QM2.

Figure 5-5 Queue definitions in QM1

5.1.4 Create a sender channel

A sender channel is a channel that initiates transfers, removes messages from a transmission queue, and moves them over a communication link to a receiver or requester channel. To create the sender channel:

1. Navigate to Queue Managers QM1 Advanced Channels.

2. Right-click Channels and select New Sender Channel.

3. Type QM1.TO.QM2 in the Name field, and click Next.

4. In the Connection Name field, type the IP address or host name of the system hosting the QM2 queue manager concatenated with its listener port number in parentheses. In this example, because QM1 and QM2 are both on the same system, and the listener port for QM2 is 1415, we can use

localhost(1415) or 127.0.0.1(1415).

5. Type QM2 in the Transmission Queue field. This is the queue defined earlier in “Create a transmission queue” on page 113.

Figure 5-6 Create a sender channel

This completes the configuration of the objects on QM1.

The next series of steps configures the objects on QM2 objects. This includes a target queue and receiver channel.

5.1.5 Create a local queue

The local queue on QM2 is the target queue of the remote queue definition on QM1. To create the queue:

1. Navigate to Queue Managers QM2 Queues.

2. Right-click Queues.

3. Select New Local Queue.

4. Type TARGET in the Name field and click Finish. Note that TARGET matches the name defined in the remote queue field of MQLINK in QM1 (see “Create a remote queue definition” on page 112).

Figure 5-7 Create a local queue of the target

5.1.6 Create a receiver channel

The receiver channel is a channel that responds to a sender channel, taking messages from a communication link. To create the receiver channel: 1. Navigate to Queue Managers QM2 Advanced Channels.

2. Right-click Channels and select New Receiver Channel.

3. Type QM1.TO.QM2 in the Name field. Note that the sender and receiver channels must have the same name. This matches the sender channel defined in “Create a sender channel” on page 114). Unlike the sender channel, the receiver channel does not need the connection name defined. 4. Click Finish.

Figure 5-8 Create a receiver channel

5.1.7 Start the sender channel

Now that the definitions are complete, start the sender channel by right-clicking the QM1.TO.QM2 sender channel under QM1 and selecting Start.

When the channel starts successfully, the status will change to Running and the icon will turn green. Note that the receiver channel icon also turns green.

Figure 5-9 Start the sender channel

5.1.8 Test the connection

The easiest way to test the connection is using RFHUtil. This utility is provided as SupportPac™ IH03 and can be downloaded from the following location:

http://www-1.ibm.com/support/docview.wss?rs=203&uid=swg24000637&loc=en_US&cs=ut f-8&lang=en

An XML file can be used for testing. We used Airline1.xml from “Sample XML files” on page 270.

To test the connection: 1. Run rfhutil.exe.

2. Select QM1 in the Queue Manager name field. 3. Select MQLINK in Queue Name field.

Figure 5-10 RFHUTIL Main panel

5. Click the Write Queue button.

The XML data will be put on the MQLINK and sent to the TARGET queue in QM2.

6. You can see the message on the TARGET queue using WebSphere MQ Explorer. Click Queues under QM2. Select TARGET from the list displayed, right-click, and select Browse Messages.

Figure 5-11 Delivered message in TARGET queue

In document Enabling SOA Using WebSphere Messaging (Page 124-132)