Professional Documents
Culture Documents
September 2009
Notice 2009 Tata Consultancy Services Ltd. This is a controlled document. Unauthorized access, copying, replication or usage for a purpose other than for which it is intended, are prohibited. All trademarks that appear in the document have been used for identification purposes only and belong to their respective companies.
Confidential
22-Sep-2009
1.0
Deepa Chandra
Initial Version
Confidential
Intended Audience
This document is intended for administrators working on WebSphere MQ products. It is also intended to act as a reference for developers to improve the overall understanding of the product.
Prerequisites
Completion of WebSphere MQ E1-Level Training / Good understanding of WebSphere MQ concepts Familiarity with MQSC commands Basic understanding of the Java programming language Basic understanding of operating system concepts Hardware - Minimum 1 GB RAM (1.6 GHz Pentium M or higher), 4 GB Hard Disk free disk space Software o Window XP OS with service pack 2 or Windows 2K Professional o Installable for WebSphere MQ v6.0 o RAD or Eclipse IDE o 'RFHUtil' utility
Confidential
CONTENTS
1 MQ Lab Exercises Day 1...................................................................................... 5
1.1 1.2 1.3 1.4 1.5 ASSIGNMENT 1: CLUSTER SETUP DEFINE REPOSITORIES ....................................................... 5 ASSIGNMENT 2: CLUSTER SETUP ADD QUEUE MANAGERS TO CLUSTER............................... 9 ASSIGNMENT 3: CLUSTER QUEUE SETUP ............................................................................... 12 ASSIGNMENT 4: MULTIPLE QUEUE OCCURRENCE PUT MESSAGES TO CLUSTER QUEUE ..... 14 ASSIGNMENT 5: WORKLOAD BALANCING .............................................................................. 16
Confidential
1
1.1
Purpose: A cluster defines a group of queue managers where every queue manager can make the queues that they host accessible to other queue managers in the cluster. Queue managers can communicate with each other without creating explicit channels or transmission queues for each destination queue manager. This exercise illustrates how to set up repositories for a cluster. Instruction: Create a cluster, PLANETS with queue managers, JUPITER and MARS as the full repositories.
On queue manager, JUPITER, o Alter the queue manager to make it a full repository for the cluster, PLANETS o Define cluster receiver channel to itself o Define cluster sender channel to MARS On queue manager, MARS, o Alter the queue manager to make it a full repository for the cluster, PLANETS o Define cluster receiver channel to itself o Define cluster sender channel to JUPITER Solution: On queue manager, JUPITER,
Confidential 5
Confidential
The channels will automatically start running once the corresponding cluster sender and cluster receiver pair is created. If not, check the definition of the cluster channels
Confidential
Issue following MQSC command on the queue managers to check if the cluster has been set up successfully: DIS CLUSQMGR (*) CLUSTER (PLANETS)
Confidential
1.2
Confidential
Issue following MQSC command on the queue managers to check if the queue managers have been added successfully to the cluster: DIS CLUSQMGR (*) CLUSTER (PLANETS)
Confidential 10
On the full repositories, all the four queue managers will be visible.
A partial repository, upon joining a cluster, learns about the queue managers in the cluster that hold full repositories. The queue manager can then request information from any of the repositories when they first need to access another queue or queue manager, and also request to be notified of any changes concerning that queue or queue manager. On each of the partial repositories, the information about the other partial repository queue manager will be unavailable at the moment till it needs to access that queue manager.
Confidential
11
1.3
Confidential
12
Issue the following MQSC command on the queue managers, DIS QCLUSTER (SATELLITE) Two instances of the queue will be seen, with only the CLUSQMGR value differing
Confidential
13
1.4
Confidential
14
All messages will be on queue, SATELLITE of one queue manager (say, PLUTO). The current depth of the queue on the other queue manger (SATURN) shows zero messages. This is because the DEFBIND attribute for both the queues is set as OPEN. Therefore on MQOPEN, the destination queue instance is selected and will not be changed until MQCLOSE. Hence all messages are sent to the same queue instance.
Confidential
15
1.5
Confidential
16
The messages will alternate between the queues, SATELLITE on queue managers, SATURN and PLUTO.
Confidential
17
Solution: On queue manager, MARS, o Create a namelist for the clusters, PLANETS and CHOCOLATE o Alter the queue manager to make it a full repository for the two clusters o Define cluster receiver channel to itself, for cluster, CHOCOLATE
Confidential 18
Alternately you can use the same cluster sender and cluster receiver channels for more than one clusters. In that case, use the attribute CLUSNL instead of CLUSTER on the channels. Follow solution for Assignment - Error! Reference source not found. for adding queue managers, KITKAT and SNICKERS to the cluster. Issue following MQSC command on the queue managers to check if the clusters have been set up successfully: DIS CLUSQMGR (*) CLUSTER (CHOCOLATE) DIS CLUSQMGR (*) CLUSTER (*)
Confidential
19
Confidential
20
2.2
Purpose: This exercise demonstrates how to set up a cluster queue belonging to multiple clusters. Instruction: Create local queue, DARKCHOCOLATE on queue manager, KITKAT belonging to cluster, CHOCOLATE. Create another local queue, COMET on MARS and add it to the clusters, PLANETS and CHOCOLATE. Issue the following MQSC command on the queue managers, MARS & SATURN and check the outcome. DIS QCLUSTER (DARKCHOCOLATE) DIS QCLUSTER (COMET) Solution:
Issue the following MQSC commands on the queue manager, MARS DIS QCLUSTER (COMET) Two instances of the queue will be seen, one belonging to cluster PLANETS and one belonging to CHOCOLATE. DIS QCLUSTER (DARKCHOCOLATE)
Confidential 21
Issuing amqsput COMET SATURN at the command prompt and pressing enter twice, will make the queue, COMET be known to SATURN. Issue the following MQSC commands on the queue manager, SATURN DIS QCLUSTER (COMET) One instance of the queue will be seen DIS QCLUSTER (DARKCHOCOLATE) No instance of the queue is seen since the queue, DARKCHOCOLATE is in cluster CHOCOLATE of which SATURN is not a part of.
Confidential
22
2.3
Purpose: In case of overlapping clusters, it is possible to use an alias queue belonging to one cluster to put messages on a local queue hosted by a different queue manager and belonging to another cluster. This exercise illustrates the same. Instruction: Create an alias queue, MYALIAS on queue manager, MARS belonging to cluster, CHOCOLATE. The base queue is to be SATELLITE. DEF QA (MYALIAS) + CLUSTER (CHOCOLATE) + TARGQ (SATELLITE) a) Put a message on to queue MYALIAS using amqsput from queue manager KITKAT. Check where the messages have been delivered. b) Rectify the error Solution:
Confidential
23
a) amqsput MYALIAS KITKAT The messages will land on the dead letter queue of MARS. The dead letter handler will show the reason as MQRC 2082 (MQRC_UNKNOWN_ALIAS_BASE_Q). The DEFBIND option of the alias queue is set to OPEN. Hence at MQOPEN, MYALIAS requires a base queue which can physically hold the messages. SATELLITE is a clustered queue residing in a remote queue manager; hence the error.
b) On queue manager, MARS, ALTER QA (MYALIAS) + DEFBIND (NOTFIXED) The error will be rectified and the messages will be sent to one of the instances of queue, SATELLITE.
Confidential 24
Confidential
25
Purpose: To demonstrate how a clustered set up can work along with a point-to-point setup. Instruction:
For the setup mentioned in the above figure, a) From queue manager VENUS (Port # 8005), send a message to queue, SATELLITE on SATURN. (Hint: Use Remote Queue Definition) b) From queue manager SATURN, send a message to queue, V on VENUS. (Hint: Use Queue Manager Alias) c) From queue manager KITKAT, send a message to queue, V on VENUS. (Hint: Use Queue Manager Alias) d) From queue manager VENUS, send a message to queue, DARKCHOCOLATE on KITKAT. Solution: Ensure that the connectivity between queue managers VENUS and JUPITER exists (via distributed queuing). Create local queue, V on VENUS
Confidential 26
amqsput SATELLITE VENUS The messages will land on queue SATELLITE on SATURN.
Confidential
27
Through API exerciser, connect to SATURN. In advanced mode for MQOPEN, specify ObjectName V ObjectQMgrName VENUS.QM Put messages OR On SATURN, define a remote queue definition with RNAME as V and RQMNAME as VENUS.QM
amqsput V SATURN c) On MARS, create a queue manager alias pointing to VENUS.QM on JUPITER
Confidential
28
Note: Since the xmitq is empty, it will take SYSTEM.CLUSTER.TRANSMIT.QUEUE as the transmission queue. Through API exerciser, connect to KITKAT. In advanced mode for MQOPEN, specify ObjectName V ObjectQMgrName VENUS.RQM Put messages OR On KITKAT, define a remote queue definition with RNAME as V and RQMNAME as VENUS.RQM
amqsput V KITKAT d) On VENUS, create a remote queue definition to queue, DARKCHOCOLATE with RQMNAME as KITKAT.QM
Confidential
29
3.2
Purpose: To demonstrate how to remove a queue manager temporarily from the cluster and to re-instate it back into the cluster. The command for temporary removal of queue manager can be useful if the queue manager has to be brought down for maintenance. Instruction:
Confidential
30
Remove the queue manager, SATURN from cluster, PLANETS temporarily. Put 2 messages to the queue, SATELLITE and check to which queue instance the messages are delivered. Solution: On queue manager, SATURN, SUSPEND QMGR CLUSTER (PLANETS) The messages sent to queue, SATELLITE will no longer be routed to SATURN. Although it is suspended from the cluster, all information about SATURN is preserved in the repositories. The MQSC command, DIS CLUSQMGR (*) CLUSTER (PLANETS) SUSPEND shows if the queue manager is suspended or not
Confidential
31
Put messages using the following command: amqsput SATELLITE JUPITER The messages will be delivered only to the queue, SATELLITE on queue manager PLUTO. To resume the queue manager in the cluster, issue RESUME QMGR CLUSTER (PLANETS)
Note: Alternately use the attribute CLUSNL instead of CLUSTER to suspend or resume queue managers from multiple clusters.
Confidential
32
Purpose: The most common combination involving message channels is when a sender initiates a communication with a receiver and sends messages to it. However, there exists another combination where a requester can initiate a communication with a sender. The sender terminates the communication connection promptly and starts another communication connection with the requester (using its channel definition details) and sends messages to it. This is called a callback combination. This exercise explores the callback mechanism involving the message channel pairRequester-Sender
Instruction: Create a requester channel (A.TO.B) on queue manager, JUPITER. Create a sender channel (A.TO.B) on queue manager, MARS. (Ensure that if a sender channel exists from MARS to JUPITER, it is in stopped state) Through the API exerciser, connect to MARS. Click on Open queue option, in advanced mode. Specify ObjectName - J ObjectQMgrName - JUPITER Put 5 messages. Check where the messages are available. Solution: On queue manager, JUPITER,
Confidential
33
Put 5 messages through API exerciser. The messages will stay in the transmission queue, JUPITER on queue manager, MARS.
Start the requester channel on queue manager, JUPITER. This automatically starts the sender channel and messages will be delivered to queue, J on queue manager JUPITER.
Confidential
34
4.2
Confidential
35
The following control command records the media image of the queue, ADMIN rcdmqimg m COMPANY t queue ADMIN
4.3
This exercise explains how to locate a queue file and demonstrates what error is shown when a damaged object is accessed. Instruction: Delete the queue file for ADMIN. The path of the queue file can be determined using the command: dspmqfls [-m QMgrName] [-t ObjType] GenericObjName Issue the display command on MQSC mode. Discuss the result. Solution: o The control command, dspmqfls shows the path where the queue file for ADMIN is stored.
The result shows the error AMQ8149: WebSphere MQ Object damaged. If the queue is accessed for putting messages, it returns the error code 2101 (MQRC_OBJECT_DAMAGED).
Confidential
37
4.4
Confidential
38
4.5
DEF QMODEL (DYN.SAMPLE) + DEFTYPE (PERMDYN) Import the following zip file onto a new workspace on an eclipse based IDE.
Build the project and run MessagePutOnDynamicQueue specifying two arguments, where args[0] Instance of the local queue to be created args[1] Name of the model queue Run the java program twice, once with a temporary dynamic queue name (e.g. SYSTEM.DEFAULT.MODEL.QUEUE) for args[1] and then with a permanent dynamic queue name (e.g. DYN.SAMPLE). Once the message Message put successful is seen on console, open command prompt, RUNMQSC <QueueManagerName> DIS Q (QueueName) where QueueName - Instance of the local queue. Check the CURDEPTH attribute. END amqsbcg <QueueName> <QueueManagerName> This displays the contents of the message. Solution: On queue manager, VENUS, create a permanent dynamic queue, DYN.SAMPLE.
Run the java program specifying TEMPQ and SYSTEM.DEFAULT.MODEL.QUEUE as the arguments
Confidential
40
Once the message Message put successful is seen on console, open command prompt, RUNMQSC VENUS DIS Q (TEMPQ) Check the CURDEPTH attribute. It should be 1. END
Confidential 41
amqsbcg TEMPQ VENUS Note: The queue, TEMPQ will be deleted once the application ends. Run the java program specifying PERMQ and DYN.SAMPLE as the arguments. Once the message Message put successful is seen on console, open command prompt, RUNMQSC VENUS DIS Q (PERMQ) Check the CURDEPTH attribute. It should be 1. END amqsbcg PERMQ VENUS The queue, PERMQ can be viewed in the MQSC prompt or at the MQExplorer even after the application has terminated.
Confidential
42
Confidential
43