Friday 22 January 2016

Making an existing queue manager the default

When you create a default queue manager, its name is inserted in the Name attribute of the DefaultQueueManager stanza in the WebSphere MQ configuration file (mqs.ini). The stanza and its contents are automatically created if they do not exist. 

[mqm@middlewaretech mqm]$ pwd
/var/mqm
[mqm@middlewaretech mqm]$ vi mqs.ini


To make an existing queue manager the default, change the queue manager name on the Name attribute to the name of the new default queue manager. You can do this manually, using a text editor. 

If you do not have a default queue manager on the node, and you want to make an existing queue manager the default, create the DefaultQueueManager stanza with the required name yourself. 

If you accidentally make another queue manager the default and want to revert to the original default queue manager, edit the DefaultQueueManager stanza in mqs.ini, replacing the unwanted default queue manager with that of the one you want.
-------------------------------------------------------------------------------------------------

Important configuration files

  When you install the product, the WebSphere MQ configuration file (mqs.ini) is created. It contains a list of queue managers that is updated each time you create or delete a queue manager. There is one mqs.ini file per node.

When you create a new queue manager, a new queue manager configuration file (qm.ini) is automatically created. This contains configuration parameters for the queue manager.After creating a queue manager, we recommend that you back up your configuration files.

Queue managers

A queue manager manages the resources associated with it, in particular the queues that it owns. It provides queuing services to applications for Message Queuing Interface (MQI) calls and commands to create, modify, display, and delete WebSphere MQ objects.

Before you can do anything with messages and queues, you must create and start at least one queue manager and its associated objects. To create a queue manager, use the WebSphere MQ control command crtmqm. The crtmqm command automatically creates the required default objects and system objects.

Optional parameters
-c Text
 Descriptive text for this queue manager. You can use up to 64 characters; the default is all blanks. 

 -d DefaultTransmissionQueue
 The name of the local transmission queue where remote messages are put if a transmission queue is not explicitly defined for their destination. There is no default.

 -h MaximumHandleLimit
The maximum number of handles that any one application can have open at the same time.Specify a value in the range 1 through 999 999 999. The default value is 256.

-lc Use circular logging. This is the default logging method.
-ll Use linear logging.
-ld LogPath The directory used to hold log files.

-lf LogFilePages
The log data is held in a series of files called log files. The log file size is specified in units of 4 KB pages. In WebSphere MQ for UNIX systems, the default number of log file pages is 1024, giving a log file size of 4 MB. The minimum number of log file pages is 64 and the maximum is 65 535. 

Note: The size of the log files specified during queue manager creation cannot be changed for a queue manager.

-lp LogPrimaryFiles
The log files allocated when the queue manager is created. The minimum number of primary log files you can have is 2 and the maximum is 254 on Windows, or 510 on UNIX systems. The default is 3. The total number of primary and secondary log files must not exceed 255 on Windows, or 511 on UNIX systems, and must not be less than 3. Operating system limits can reduce the maximum possible log size. The value is examined when the queue manager is created or started. You can change it after the queue manager has been created. However, a change in the value is not effective until the queue manager is restarted, and the effect might not be immediate.

-ls LogSecondaryFiles

The log files allocated when the primary files are exhausted. The minimum number of secondary log files is 1 and the maximum is 253 on Windows, or 509 on UNIX systems. The default number is 2. The total number of primary and secondary log files must not exceed 255 on Windows, or 511 on UNIX systems, and must not be less than 3.

-q Makes this queue manager the default queue manager. The new queue manager replaces any existing default queue manager.

-u DeadLetterQueue
The name of the local queue that is to be used as the dead-letter (undelivered-message) queue. Messages are put on this queue if they cannot be routed to their correct destination.

Examples

1. This command creates a default queue manager called Paint.queue.manager, with a description of Paint shop, and creates the system and default objects. It also specifies that linear logging is to be used:

crtmqm -c "Paint shop" -ll -q Paint.queue.manager

 2. This command creates a default queue manager called Paint.queue.manager, creates the system and default objects, and requests two primary and three secondary log files:

 crtmqm -c "Paint shop" -ll -lp 2 -ls 3 -q Paint.queue.manager

Starting a queue manager

Starting a queue manager Although you have created a queue manager, it cannot process commands or MQI calls until you start it. You do this using the strmqm command as follows

strmqm Paint.queue.manager

Stopping a queue manager

Use the endmqm command to stop a queue manager

endmqm   Paint.queue.manager

Optional parameters

Quiesced shutdown

By default, the endmqm command performs a quiesced shutdown of the specified queue manager. This might take a while to complete. A quiesced shutdown waits until all connected applications have disconnected. Use this type of shutdown to notify applications to stop.

If you issue: endmqm -c Paint.queue.manager

 you are not told when all applications have stopped. (An : endmqm -c Paint.queue.manager
 command is equivalent to an : endmqm  Paint.queue.manager command.)

 However, if you issue: endmqm -w Paint.queue.manager the command waits until all applications have stopped and the queue manager has ended.

 Immediate shutdown

For an immediate shutdown any current MQI calls are allowed to complete, but any new calls fail. This type of shutdown does not wait for applications to disconnect from the queue manager. For an immediate shutdown, type:

 endmqm -i Paint.queue.manager

Preemptive shutdown

If an immediate shutdown does not work, you must resort to a preemptive shutdown, specifying the -p flag. For example:

endmqm -p Paint.queue.manager

This stops the queue manager immediately.

Deleting a queue manager

 To delete a queue manager, first stop it, then issue the following command:

dltmqm Paint.queue.manager

Notes: Deleting a queue manager is a drastic step, because you also delete all resources associated with the queue manager, including all queues and their messages and all object definitions. There is no displayed prompt that allows you to change your mind; when you press the Enter key all the associated resources are lost.

Optional parameters

 -z Suppresses error messages.

The following command deletes the queue manager Paint.queue.manager  and also suppresses any messages caused by the command.


dltmqm -z Paint.queue.manager

Sunday 17 January 2016

MCA

Message Channel Agent (MCA)

A message channel agent is an IBM MQ program that controls the sending and receiving of messages. Message channel agents move messages from one queue manager to another; there is one message channel agent at each end of a channel.

One MCA takes messages from the transmission queue and puts them on the communication links. The other MCA receives messages and delivers them onto a queue on the remote QMGR.


A message channel agent is called a caller MCA if it initiated the communication, otherwise it is Called a responder MCA.  A caller MCA may be associated with sender, cluster sender, server or requester channel. A responder MCA may be associated with any type of message channel , except a cluster sender.


In MQ Six types of MCA's Available

  • Sender MCA (SDR)
  • Server MCA (SVR)
  • Receiver MCA (RCVR)
  • Requester MCA (RQSTR)
  • Cluster-sender MCA  (CLUSSDR)
  • Cluster-receiver MCA (CLUSRCVR)

Message channel agent type (MCATYPE) : This attribute can specify the message channel agent as a process or a thread.

 Advantages of running as a process include:
  • Isolation for each channel providing greater integrity
  • Job authority specific for each channel
  • Control over job scheduling
Advantages of threads include:

  • Much reduced use of storage
  • Easier configuration by typing on the command line
  • Faster execution - it is quicker to start a thread than to instruct the operating system to start a process
Possible Combinations of message channels

A message channel is a communication link between two queue managers.
A message channel is defined using one of these types defined at one end, and a compatible type at the other end. passable combinations are:

1.SDR-RCVR
2. SDR-RQSTR
3. SVR - RCVR
4. SVR - RQSTR
5. CLUSSDR - CLUSRCVR

Sender -> Initiate connection to receiver
Receiver -> Passive, waits for Initiation sequences from sender
Server-> Initiate connection to receiver, responds for requester
Requester -> Initiate connection then becomes receiver

Sunday 10 January 2016

Queue Manager Interconnection

In this post I am going to briefly demonstrate MQ intercommunication. What I mean by intercommunication is allowing a message to be put on a local queue on a local queue manager and to have that message sent to a remote queue on a remote queue manager.
  
High level Steps create the MQ intercommunication :

Destination QMGR
1:  Create the Destination QMGR
2: Create Local queue where the message needs to be received
3: Define Listener and Start the Listener
4: Create Receiver Channel with same name as the Sender channel
5: Start the Receiver Channel

Source QMGR
1: Create the QMGR
2: Define Transmission Queue
3: Create Sender Channel
4: Create Remote Queue Definitions
5: Start the Sender Channel
=================================================================
        Detailed Steps  
==================================================================
Destination Queue Manager

1: Create a Destination Queue Manager QM02

[mqm@middlewaretech ~]$ crtmqm QM02

There are 82 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager created.
Directory '/var/mqm/qmgrs/QM02' created.
The queue manager is associated with installation 'Installation1'.
Creating or replacing default objects for queue manager 'QM02'.
Default objects statistics : 74 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.

2. Start Queue Manager QM02

[mqm@middlewaretech ~]$ strmqm QM02

There are 82 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager 'QM02' starting.
The queue manager is associated with installation 'Installation1'.
5 log records accessed on queue manager 'QM02' during the log replay phase.
Log replay for queue manager 'QM02' complete.
Transaction manager state recovered for queue manager 'QM02'.
WebSphere MQ queue manager 'QM02' started using V7.5.0.2.


3:  Enter the MQSC prompt of QM02 and create Local Queue in the Dest QMGR where the message is to be received from the Source QMGR QM01

[mqm@middlewaretech ~]$ runmqsc QM02
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM02.

 DEFINE QLOCAL(QL.A)
     1 : DEFINE QLOCAL(QL.A)
AMQ8006: WebSphere MQ queue created.
end
 2 : end
1 MQSC commands read.
No commands have a syntax error.
One valid MQSC command could not be processed.

4. Define  a listener for the QM02 which allows our sending queue manager (QM01) to connect via channel. We are going to make the listener use port 24000.

[mqm@middlewaretech ~]$ runmqsc QM02
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM02.

DEFINE LISTENER(QM02.LISTENER) TRPTYPE(TCP) PORT(24000) IPADDR(192.168.1.12)
     1 : DEFINE LISTENER(QM02.LISTENER) TRPTYPE(TCP) PORT(24000) IPADDR(192.168.1.12)
AMQ8626: WebSphere MQ listener created.
START LISTENER(QM02.LISTENER)
     2 : START LISTENER(QM02.LISTENER)
AMQ8021: Request to start WebSphere MQ listener accepted.
DISPLAY LSSTATUS(QM02.LISTENER)
     3 : DISPLAY LSSTATUS(QM02.LISTENER)
AMQ8631: Display listener status details.
   LISTENER(QM02.LISTENER)                 STATUS(RUNNING)
   PID(4936)                               STARTDA(2016-01-10)
   STARTTI(19.12.16)                       DESCR( )
   TRPTYPE(TCP)                            CONTROL(MANUAL)
   IPADDR(::ffff:192.168.1.12)             PORT(24000)
   BACKLOG(100)             
end
     4 : end
3 MQSC commands read.
No commands have a syntax error.

 I have started Listener and status is running.
You will notice in this listener I added the ipaddr parameter this is to show that you can see what ipaddress you wish to listen on. This is key for intercommunication. Remember firewalls will need to be configures if you have them to allow communication on these ports.

5. Define the Receiver Channel CHL(QM01.QM02)

[mqm@middlewaretech ~]$ runmqsc QM02
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM02.
                      
DEFINE CHL(QM01.QM02) CHLTYPE(RCVR) REPLACE TRPTYPE(TCP)
     1 : DEFINE CHL(QM01.QM02) CHLTYPE(RCVR) REPLACE TRPTYPE(TCP)
AMQ8014: WebSphere MQ channel created.
end
     2 : end
1 MQSC commands read.
No commands have a syntax error.
One valid MQSC command could not be processed.


##################################################################

Source Queue Manager  

##################################################################

1: Create the source queue manager QM01 and start it

[mqm@middlewaretech ~]$ crtmqm QM01
There are 82 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager created.
Directory '/var/mqm/qmgrs/QM01' created.
The queue manager is associated with installation 'Installation1'.
Creating or replacing default objects for queue manager 'QM01'.
Default objects statistics : 74 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.

2. Start Queue Manager QM01

[mqm@middlewaretech ~]$ strmqm QM01
There are 82 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager 'QM01' starting.
The queue manager is associated with installation 'Installation1'.
5 log records accessed on queue manager 'QM01' during the log replay phase.
Log replay for queue manager 'QM01' complete.
Transaction manager state recovered for queue manager 'QM01'.
WebSphere MQ queue manager 'QM01' started using V7.5.0.2.

3. Create the Transmission Queue : QM02.XMITQ and Define the Remote Queue Definitions with Remote Queue Name and Remote QMGR Name

we need to do now is create a transmission queue on QM01. We require a transmission queue to be able to talk to a channel object. We use a channel to allow QM01 to talk to QM02. We will also need to create a remote queue definition which will represent our remote queue QL.A on QM02 which we want to send messages to.


[mqm@middlewaretech ~]$ runmqsc QM01
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM01.


DEFINE QLOCAL(QM02.XMITQ) REPLACE USAGE(XMITQ)
     1 : DEFINE QLOCAL(QM02.XMITQ) REPLACE USAGE(XMITQ)
AMQ8006: WebSphere MQ queue created.

DEFINE QREMOTE(QRMT02) RNAME(QL.A) RQMNAME(QM02) XMITQ(QC02.XMITQ)
     2 : DEFINE QREMOTE(QRMT02) RNAME(QL.A) RQMNAME(QM02) XMITQ(QC02.XMITQ)
AMQ8006: WebSphere MQ queue created.

end
     3 : end
2 MQSC commands read.
No commands have a syntax error.
All valid MQSC commands were processed.

  4. Create the Sender Channel QM01.QM02  with these details

a)  CHLTYPE and TRPTYPE ( as we are using TCP protocol for connection )
b) CONNAME ( Use the Ip address of the Destination QMGR and the port of the Dest Listener)
c) XMITQ ( Use the Transmission Queue for the senders channel )

NOTE : The Sender Channel Name created here should be same as the Receive Channel created for the Destination QMGR QM02

[mqm@middlewaretech ~]$ runmqsc QM01
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM01.
  
DEFINE CHANNEL(QM01.QM02) CHLTYPE(SDR) REPLACE TRPTYPE(TCP) CONNAME('192.168.1.12(24000)') XMITQ(QM02.XMITQ)
     1 : DEFINE CHANNEL(QM01.QM02) CHLTYPE(SDR) REPLACE TRPTYPE(TCP) CONNAME('192.168.1.12(24000)') XMITQ(QM02.XMITQ)
AMQ8014: WebSphere MQ channel created.

START CHANNEL(QM01.QM02)
     2 : START CHANNEL(QM01.QM02)
AMQ8018: Start WebSphere MQ channel accepted.
display chstatus(QM01.QM02)
     3 : display chstatus(QM01.QM02)
AMQ8417: Display Channel Status details.
   CHANNEL(QM01.QM02)                      CHLTYPE(SDR)
   CONNAME(192.168.1.12(24000))            CURRENT
   RQMNAME(QM02)                           STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(QM02.XMITQ)

 display chstatus(QM01.QM02)

end
     4 : end
3 MQSC commands read.
No commands have a syntax error.
All valid MQSC commands were processed.
 ==================================================================
 Testing

 ===================================================================

1. Ensure that the listeners is started and running on the Dest Qmgr Server QM02

[mqm@middlewaretech bin]$ runmqsc QM02
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM02.


DISPLAY LSSTATUS (QM02.LISTENER)
     1 : DISPLAY LSSTATUS (QM02.LISTENER)
AMQ8631: Display listener status details.
   LISTENER(QM02.LISTENER)                 STATUS(RUNNING)
   PID(5539)                               STARTDA(2016-01-10)
   STARTTI(19.21.07)                       DESCR( )
   TRPTYPE(TCP)                            CONTROL(MANUAL)
   IPADDR(::ffff:192.168.1.12)             PORT(24000)
   BACKLOG(100)                         
end
     2 : end
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
[mqm@middlewaretech bin]$ 

2. Ensure the Receiver channel is started on the Destination Qmgr Server QM02

[mqm@middlewaretech bin]$ runmqsc QM02
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM02.

DISPLAY CHSTATUS(QM01.QM02)
     1 : DISPLAY CHSTATUS(QM01.QM02)
AMQ8417: Display Channel Status details.
   CHANNEL(QM01.QM02)                      CHLTYPE(RCVR)
   CONNAME(192.168.1.12)                   CURRENT
   RQMNAME(QM01)                           STATUS(RUNNING)
   SUBSTATE(RECEIVE)                    
end
     2 : end
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
[mqm@middlewaretech bin]$ 


3. Ensure that the Sender Channel is started and running on the Source Qmgr Server QM01

 [mqm@middlewaretech bin]$ runmqsc QM01
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QM01.

DISPLAY CHSTATUS(QM01.QM02)
     1 : DISPLAY CHSTATUS(QM01.QM02)
AMQ8417: Display Channel Status details.
   CHANNEL(QM01.QM02)                      CHLTYPE(SDR)
   CONNAME(192.168.1.12(24000))            CURRENT
   RQMNAME(QM02)                           STATUS(RUNNING)
   SUBSTATE(MQGET)                         XMITQ(QM02.XMITQ)
end
     2 : end
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.
[mqm@middlewaretech bin]$ 


4.What we want to do now is put a message on the remote queue definition QRMT02  in  in the source Qmgr QM01 . and see if it arrives on the remote queue manager.

 If the configurations are proper then this message should be received by the Destination Queue QL.A on Qmgr QM02

[mqm@middlewaretech bin]$ pwd
/opt/mqm/samp/bin

[mqm@middlewaretech bin]$ ./amqsput QRMT02 QM01
Sample AMQSPUT0 start
target queue is QRMT02
This is test message

Sample AMQSPUT0 end
[mqm@middlewaretech bin]$ 
[mqm@middlewaretech bin]$ ./amqsgbr QL.A QM02
Sample AMQSGBR0 (browse) start
QM02
Messages for QL.A                                            
1 <This is test message>
no more messages
Sample AMQSGBR0 (browse) end

So the Message would flow internally from




Thursday 7 January 2016

IBM MQ Basics

This post include a summary on IBM WebSphere MQ Queue Managers, Queues , Channels and Messages. Knowing these concepts will help you to do simple tasks like creating a queue, sending and receiving messages from a queue.

1. Queue Managers

Queue manager is the top level object that holds in the network (Such as queues and channels).        Queue manager names must be unique. The main tasks done through a queue manager are,

Start channels
Process MQI calls
Create, delete, alter queues and channel definitions
Run a command server to process MQSC commands
Coordinator for all queue operations.

2. Queues

Queue holds the messages destined to it and send the messages to consumers in the receiving order. A queue has two defined limits.

Maximum number of messages that it can hold
Maximum length of a message.

There are several queue types that can be used with the IBM MQ. They are,

Local queue:
A local queue object identifies a local queue belonging to the queue manager to which the application is connected. All queues are local queues in the sense that each queue belongs to a queue manager and, for that queue manager, the queue is a local queue. Local queues allow programs to both put messages on , and get messages off.

There are again three types of specifications. They are:

Transmission queue 
Initiation queue
Dead Letter queue 

a. Transmission queue - This type of Queue Holds the message that is destined for Remote queue. Whenever communication link is available the message would be forwarded to that queue.

Transmission queues are  temporarily stores messages that are destined for a remote queue manager. You must define at least one transmission queue for each remote queue manager to which the local queue manager is to send messages directly.

b. Initiation queue - This local queue in which QMgr puts a message to start an application when certain conditions are satisfied.

c. Dead Letter queue - This Dead letter queue is used by QMgr and as well as other applications to put the message when they cant deliver the message to the destined queue.

Remote queue: 
Remote queue definitions are definitions on the local queue manager of queues that belong to another queue manager. To send a message to a queue on a remote queue manager, the sender queue manager must have a remote definition of the target queue. Remote queues only allow programs to put messages only.

Alias queue:
Alias queues are not actually queues; they are additional definitions of existing queues. another name for a local or remote queue.  Typically used to switch queue destinations without modifying program code.

Model queue:
A model queue defines a set of queue attributes that are used as a template for creating a dynamic queue. Dynamic queues are created by the queue manager when an application issues an MQOPEN request specifying a queue name that is the name of a model queue. The dynamic queue that is created in this way is a local queue whose attributes are taken from the model queue definition. The dynamic queue name can be specified by the application or the queue manager can generate the name and return it to the application. Dynamic queues defined in this way are either temporary queues, which do not survive product restarts, or permanent queues, which do

Cluster queue:
A cluster queue is a queue that has been shared in a cluster so that all of the queue managers in the cluster can put and get from the queue using cluster channels.

3.Channels

A channel is a communication link used by distributed queue managers. There are two categories of channel in MQ:

Message channels, which are unidirectional, and transfer messages from one queue manager to another.
A message channel can transmit messages in one direction only. If two-way communication is required between two queue managers, two message channels are required.

There are six types of message channels:

Sender - initiates connection to Receiver
Server - Accepts request to start from requester, then becomes Sender
Receiver - Passive; waits for initiation sequence form Sender
Requester - Active at start, then becomes Receiver
Cluster-sender (used amongst Cluster Queue Managers)
Cluster-receiver (ditto)


MQI channels, which are bidirectional, and transfer MQI calls from a MQ client to a queue manager, and responses from a queue manager to a MQ client. 
There are two types of MQI channel : server-connection and client-connection.


4.Messages

A message any arbitrary data that one program wants to send to another. This data is called the application data. A message needs to include other information, such as its destination and possibly a return address. This type of data is called the message descriptor

There are four types of messages:

A request message is used by one program to ask another program for something (usually data). A request message needs a reply.

A reply message is used in response to a request message.

A one-way message, as you would expect, doesn’t need a reply, though it can carry data.

A report message is used when something unexpected occurs. For example, if the data in a reply message is not usable, the receiving program might issue a report message.


  • Most useful report messages are generated by the Queue Manager.  For example, Delivery confirmation.
  • Messages can have a “time-to-live”, called Expiry.  A message that has not been delivered before its expiration is removed (not given to an app)
  • What to do with undeliverable messages? Each queue manager can have a dead-letter queue.

  
A persistent message survives the restart of the queue manager. A non-persistent message does not survive a restart of the queue manager.Persistent messages are written out to logs and queue data files. If a queue manager is restarted after a failure, it recovers these persistent messages as necessary from the logged data. Messages that are not persistent are discarded if a queue manager stops, whether the stoppage is as a result of an operator command or because of the failure of some part of your system.


Monday 4 January 2016

MQ Basic Commands



 Command to lists the MQ series version

[mqm@middlewaretech mqm]$ dspmqver
Name:        WebSphere MQ
Version:     7.5.0.2
Level:       p750-002-130704.TRIAL
BuildType:   IKAP - (Production)
Platform:    WebSphere MQ for Linux (x86 platform)
Mode:        32-bit
O/S:         Linux 2.6.18-194.el5
InstName:    Installation1
InstDesc:   
Primary:     Yes
InstPath:    /opt/mqm
DataPath:    /var/mqm
MaxCmdLevel: 750

 Command to lists the queue manager name and status

[mqm@middlewaretech mqm]$ dspmq
QMNAME(QMA)                                               STATUS(Running)
QMNAME(QMA1)                                              STATUS(Running)

Command to create Queue Manager

Syntax : crtmqm <Queue Manager name>

[mqm@middlewaretech mqm]$ crtmqm Excercise1QM

There are 88 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager created.
Directory '/var/mqm/qmgrs/Excercise1QM' created.
The queue manager is associated with installation 'Installation1'.
Creating or replacing default objects for queue manager 'Excercise1QM'.
Default objects statistics : 74 created. 0 replaced. 0 failed.
Completing setup.
Setup completed.

[mqm@middlewaretech mqm]$ dspmq
QMNAME(QMA)                                               STATUS(Running)
QMNAME(QMA1)                                              STATUS(Running)
QMNAME(Excercise1QM)                                      STATUS(Ended immediately)
[mqm@middlewaretech mqm]$

 command to stop, start & delete queue manager

To start :
syntax : strmqm < Queue Manager name>


[mqm@middlewaretech mqm]$ strmqm Excercise1QM

There are 88 days left in the trial period for this copy of WebSphere MQ.
WebSphere MQ queue manager 'Excercise1QM' starting.
The queue manager is associated with installation 'Installation1'.
5 log records accessed on queue manager 'Excercise1QM' during the log replay phase.
Log replay for queue manager 'Excercise1QM' complete.
Transaction manager state recovered for queue manager 'Excercise1QM'.
WebSphere MQ queue manager 'Excercise1QM' started using V7.5.0.2.

check queue manager status:

[mqm@middlewaretech mqm]$ dspmq
QMNAME(QMA)                                               STATUS(Running)
QMNAME(QMA1)                                              STATUS(Running)
QMNAME(Excercise1QM)                                      STATUS(Running)
[mqm@middlewaretech mqm]$

To Stop:

syntax : endmqm  < Queue Manager name>


[mqm@middlewaretech mqm]$ endmqm QMA1
Quiesce request accepted. The queue manager will stop when all outstanding work
is complete.

[mqm@middlewaretech mqm]$ dspmq
QMNAME(QMA)                                               STATUS(Running)
QMNAME(QMA1)                                              STATUS(Ended normally)
QMNAME(Excercise1QM)                                      STATUS(Running)
[mqm@middlewaretech mqm]$


To Delete :

syntax : dltmqm  < Queue Manager name>

[mqm@middlewaretech mqm]$ dltmqm Excercise1QM
WebSphere MQ queue manager running.

[mqm@middlewaretech mqm]$ dltmqm QMA1
WebSphere MQ queue manager 'QMA1' deleted.

[mqm@middlewaretech mqm]$ dspmq
QMNAME(QMA)                                               STATUS(Running)
QMNAME(Excercise1QM)                                      STATUS(Running)
[mqm@middlewaretech mqm]$

Command to create  local queue (MQSC command)

Syntax : define qlocal or ql <queuename>

[mqm@middlewaretech mqm]$ runmqsc QMA

5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QMA.


define qlocal(QMAQL1)
     1 : define qlocal(QMAQL1)
AMQ8006: WebSphere MQ queue created.


end
     2 : end
No MQSC commands read.
No commands have a syntax error.
All valid MQSC commands were processed.

Command to delete  local queue (MQSC command)

[mqm@middlewaretech mqm]$ runmqsc QMA
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QMA.

delete ql(QMAQL1)
1 : delete ql(QMAQL1)
AMQ8007: WebSphere MQ queue deleted.

end
     2 : end
No  MQSC commands read.
No commands have a syntax error.
One valid MQSC command could not be processed.
[mqm@middlewaretech bin]$

Command to Put messages onto a queue

syntax : amqsput <queuename> <queuemanager name>

[mqm@middlewaretech bin]$ pwd
/opt/mqm/samp/bin

[mqm@middlewaretech bin]$ ./amqsput   QMAQL1 QMA
Sample AMQSPUT0 start
target queue is QMAQL1
Test1 test2

Sample AMQSPUT0 end

[mqm@middlewaretech bin]$ ./amqsput QMAQL1 QMA
Sample AMQSPUT0 start
target queue is QMAQL1
hello world

Sample AMQSPUT0 end

Command to browse  messages  onto a queue

syntax : amqsbcg or amqsgbr <queuename> <queuemanager name>


[mqm@middlewaretech bin]$ ./amqsgbr QMAQL1 QMA
Sample AMQSGBR0 (browse) start
QMA
Messages for QMAQL1                                         
1 <Test1 test2>
2 <hello world>
no more messages
Sample AMQSGBR0 (browse) end
  

Command to delete messages from a queue

The amqsget or amqsgetc commands can be used to clear all the messages in a queue: each
messages deleted after it is read. There is another way to delete all the messages in the queue.
Actually, it is faster because the messages are not read. However, only an MQ Administrator can use
this method because it is done under the runmqsc command.


 [mqm@middlewaretech bin]$ runmqsc QMA
5724-H72 (C) Copyright IBM Corp. 1994, 2011.  ALL RIGHTS RESERVED.
Starting MQSC for queue manager QMA.


CLEAR QLOCAL(QMAQL1)
     1 : CLEAR QLOCAL(QMAQL1)
AMQ8022: WebSphere MQ queue cleared.
end
     2 : end
One MQSC command read.
No commands have a syntax error.
All valid MQSC commands were processed.

[mqm@middlewaretech bin]$ ./amqsgbr QMAQL1 QMA
Sample AMQSGBR0 (browse) start
QMA
no more messages
Sample AMQSGBR0 (browse) end