My Services WebSphere Training | JEE Build & Deploy | Automatic Linux Provisioning
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.
Steve Robinson has been working in IT for over 15 years and has provided solutions for many large-enterprise corporate companies across the world. Steve specialises in Java and Middleware consulting. Steve comes from both an administration and development background.
Before moving to JEE, Steve was an accomplished developer and consultant for both IBM Lotus Notes and Microsoft .NET Technologies.
Follow Steve as @stevencrobinson on twitter.
IBM WebSphere Application Server 8.0 Administration Guide
WebSphere Application Server 7.0 Administration Guide