Sunday, January 2, 2011

    This is my first example of a walk through of what samples are installed with WebSphere MQ? In my previous article "How to install WebSphere MQ version 6 on Linux Fedora 6" I showed how to install the MQ runtime and server RPM packages. Now I want to install the MQ Samples RPM so I can learn more about MQ, using the IBM samples that come with WebSphere MQ. Installing Samples: I logged in as root [root@websphere mqinstall]# rpm -ivh MQSeriesSamples-U809950-6.0.2-2.i386.rpm error: Failed dependencies: MQSeriesSamples >= 6.0.0 is needed by MQSeriesSamples-U809950-6.0.2-2.i386 I forgot I have the fix-packs, so I need to install the base version first. base install .. [root@websphere mqinstall]# rpm -ivh MQSeriesSamples-6.0.0-0.i386.rpm Preparing... ########################################### [100%] 1:MQSeriesSamples ########################################### [100%] installed fix pack .. [root@websphere mqinstall]# rpm -ivh MQSeriesSamples-U809950-6.0.2-2.i386.rpm Preparing... ########################################### [100%] 1:MQSeriesSamples-U809950########################################### [100%] OK, samples were now installed in /opt/mqm/samp WebSphere MQ Samples folder after Linux install I often use WinSCP to browse my UNIX/Linux systems as it saves a lot of time as opposed to just using putty. The screen capture above is from WinSCP. I went to look at the Websphere MQ infocentre (see link below) to see if I could find a tutorial guide. It seems that you have to install MQ on Windows to get the guide? I installed WebSphere MQ for windows and realised I probably only needed to install the WebSphere MQ explorer. I am now able to navigate to the Getting Started guide. Getting started with WebSphere MQ I am bout to use one of the samples as described in the getting started help guide: A Local Queue is a machine on the machine where the Queue is located. The Queue Manager only deals with messages on Local Queues. WebSphere MQ Getting started: Sending a message to a local queue Sending a message to a local queueA visual summary of what you will
achieve in this tutorial. For more information, see the first page of 
the
tutorial.This tutorial shows you how to set up a queue manager, QM_APPLE, and a queue, Q1, on a local, standalone installation that has no communication links with any other installations of WebSphere MQ. When you have set up these objects, you will put a test message onto the queue using the supplied program, amqsput, and verify that the test message was received using another program, amqsget. When you have completed this tutorial, you should have a basic understanding of how WebSphere® MQ messaging works in a simple messaging topology that has a queue manager with local queues. 1. Creating the queue manager Creating the queue manager using MQSC: Open a command prompt, and follow these steps: Create a default queue manager called QM_APPLE by typing the command: crtmqm -q QM_APPLEMessages tell you that the queue has been created and that the default WebSphere MQ objects have been created. Start this queue manager by typing the command: -bash-3.1$ crtmqm -q QM_APPLEMessage WebSphere MQ queue manager created. Creating or replacing default objects for QM_APPLEMessage. Default objects statistics : 40 created. 0 replaced. 0 failed. Completing setup. Setup completed. strmqm -bash-3.1$ strmqm QM_APPLEMessage WebSphere MQ queue manager 'QM_APPLEMessage' starting. 5 log records accessed on queue manager 'QM_APPLEMessage' during the log replay phase. Log replay for queue manager 'QM_APPLEMessage' complete. Transaction manager state recovered for queue manager 'QM_APPLEMessage'. WebSphere MQ queue manager 'QM_APPLEMessage' started. A message tells you when the queue manager has started. You have now created a queue manager with the name QM_APPLE. The next task is to create a local queue that this queue manager will manage. 2. Creating the local queue Creating the local queue using MQSC Open a command prompt and follow these steps: Enable MQSC commands by typing the command: runmqsc Type the following command: define qlocal (Q1) Messages tell you that the queue has been created and that the default WebSphere MQ objects have been created. Stop MQSC by typing the command: end runmqsc 5724-H72 (C) Copyright IBM Corp. 1994, 2005. ALL RIGHTS RESERVED. Starting MQSC for queue manager QM_APPLEMessage. define qlocal (Q1) 1 : define qlocal (Q1) AMQ8006: WebSphere MQ queue created. end 2 : end One MQSC command read. No commands have a syntax error. All valid MQSC commands were processed. You have now created a local queue called Q1. The next task is to put a test message to this newly created local queue. 3. Putting a test message on the local queue Putting a test message on the queue using MQSC The amqsput sample program is used to put a message on the queue that you created. (On Windows the sample programs are installed by default with WebSphere MQ Server or Client. On Linux, the samples programs RPM need to be installed.) Open a command prompt and follow these steps: Start the amqsput sample program as follows: On Linux, change to the /opt/mqm/samp/bin directory and type the command: ./amqsput Q1 On Windows, type the command: amqsput Q1 The following messages are displayed: Sample amqsput0 start target queue is Q1 Type some message text on one or more lines, then press Enter twice. The following message is displayed: Sample amqsput0 end -bash-3.1$ ./amqsput Q1 Sample AMQSPUT0 start target queue is Q1 This is my first message! Sample AMQSPUT0 end You have now created a test message and put it onto the local queue. The next task is to verify that the test message was received. 4. Verifying that the test message was sent Verifying that the test message was sent using MQSC The amqsget sample program is used to get the message back from the queue. Open a command prompt and follow these steps: Start the amqsget sample program: On Windows, type the following command:amqsget Q1 On Linux, change to the /opt/mqm/samp/bin directory and type the following command: ./amqsget Q1 The sample program starts, and your message is displayed along with any other messages on this queue. After a pause of 15 seconds, the sample ends and the command prompt is displayed again. -bash-3.1$ ./amqsget Q1 Sample AMQSGET0 start message <This is my first message!> no more messages Sample AMQSGET0 end Congratulations! You have now completed this tutorial. So is summary I installed WebSphere MQ for Windows so I could get access to the "Getting started guide" to give an an idea of how to use the samples I had installed on my Linux box. References: WebSphere MQ infocentre @ IBM http://publib.boulder.ibm.com/infocenter/wmqv6/v6r0/index.jsp Getting started guide of the Windows WebSphere MQ install.

No comments:

Post a Comment