Create WMQ QueueManager using script

Here is a handy script to make QM on Centos. This should be run after switching to mqm user.

Save the following as create_qm.sh

#!/bin/bash 
#############################################

##            Main Routine
#############################################

main(){
echo "Checking if [$qm] exists?..."
qm=`dspmq | awk '{ print $1 }' | sed 's/QMNAME(//g;s/)//g' | grep -o $qm`
if [ "$qm" = "" ];
then
echo "Creating: [$qm]"
`crtmqm $qm`
echo "Successfully created $q, Exiting with value 0"
else
echo "[$qmname], already exists"
status=`dspmq -m $qmname| cut -d '(' -f2,3 | cut -d ')' -f2 | cut -d '(' -f2`
echo status of queue manager [$qm] is [$status]
fi
echo "Exiting Main Routine.. "
}
#############################################

##                 Entry Point
#############################################

if [ ! "$1" ];
then
echo "Fail: You must pass in a queue manager name"
exit 1
else
qm=$1
echo "Queue Manager to create = $qm"
echo "Calling Main function ... "
main $*
exit 0
fi

Use following command to create Queue Manager

create_qm.sh TEST_QM1

Install WMQ6.0 on Centos

This article explains step-by-step installation of WMQ6.0 on Centos 6.0.

  • Download WMQ6.0 from IBM Website ( login required)
  • After downloading the package and extracting the same on /tmp, accept license by running mqlicense.sh script
  • Install the packages, commands listed below
rpm  -ivh  MQSeriesServer-6.0.2-3.i386.rpm
rpm  -ivh  MQSeriesRuntime-6.0.2-3.i386.rpm
rpm  -ivh  MQSeriesSDK-6.0.2-3.i386.rpm
rpm  -ivh  MQSeriesSamples-6.0.2-3.i386.rpm
rpm  -ivh  MQSeriesClient-6.0.2-3.i386.rpm
rpm  -ivh  MQSeriesJava-6.0.2-3.i386.rpm
rpm  -ivh  MQSeriesTXClient-6.0.2-3.i386.rpm
rpm  -ivh  MQSeriesServer-6.0.2-3.i386.rpm
rpm  -ivh  MQSeriesMan-6.0.2-3.i386.rpm
rpm  -ivh –nodeps  MQSeriesFTA-6.0.2-3.i386.rpm
rpm  -ivh –nodeps MQSeriesIES30-6.0.2-3.i386.rpm
rpm  -ivh –nodeps MQSeriesConfig-6.0.2-3.i386.rpm
rpm  -ivh  MQSeriesKeyMan-6.0.2-3.i386.rpm
rpm  -ivh  gsk7bas-7.0-4.11.i386.rpm
rpm  -ivh  IBMJava2-142-ia32-SDK-1.4.2-9.0.i386.rpm 
  • Done.

A Brief outline on IBM Webshpere MQ (WMQ)

IBM Websphere MQ (WMQ or MQ Series) is a middleware for messaging in a cross platform environment. MQI – Message Queue Interface – api used to commmunicate with a Message Queue Manager (MQM). 


Queue Manager (MQM) 

  • Manages queues and messages for applications 
  • Transfers messages to other Queue Managers via channels using existing network facilities. 
  • It refers to objects that are defined by the administrator.
  • Coordinates updates to databases and queues using two-phase commit. 
  • Gets and puts from/to queues are committed together with SQL updates, or backed out if necessary. 
  • Segments messages, if necessary, and assembles them. 
  • Can group messages and send them as one physical message to their destination, where they are automatically disassembled. 
  • Can send one message to more than one destination using a user-defined dynamic destination list. 
  • Allow administrators to create and delete queues, alter properties of existing queues,control the operation of queue manager. 
  • Front-end available on Eclipse to manage Queue Manager 



 Queue Manager Clusters 

  • Queue Managers that form a cluster can run in the same machine or in different machines on different platforms. 
  • Two of Queue Managers maintain a repository that contains information about all queue managers and queues in the cluster (full repository). Other Queue Managers maintain only a repository of the objects they are interested in (partial repository).
  • Queue Managers use special cluster channels to exchange information. 
  • Client application may specify a queue manager and direct the message to a specific queue in a cluster or it may let a queue manager to determine where the queue is and to which one to send the message. 
  • Client uses a Transmission Queue on its machine and destination queue is called “Target Queue”. 
  • Administrator must define the name of the cluster, when a queue is defined. 
  • MQSeries distributes the messages round robin. 



 Queue Manager Objects 

  •  A Queue Manager uses 3 types of objects, namely, Queues, Process Definitions and Channels. 
  • Queues are used to store messages. 
  • Process Definition object defines an application to a queue manager. It contains a name of a program (and its path) to be triggered when a message arrives for it.
  • Channel is a communication link. There are 2 kinds of channels, namely, Message Channels and MQI channels. 
  • Message Channel connects 2 queue managers via Message Channel Agents (MCA). Message Channel is unidirectional. 
  • MCA is a program (also called mover) that transfers messages from a transmission queue to a communication link and from communication link to a target queue. 
  • MQI channel connects MQSeries client to a queue manager and is bi-directional. 
  • Message Channel can run at 2 speeds: fast and normal. Fast Channels improve performance but messages can be lost in case of channel failure. 



Message Queues 

  • Message Queues belong to Queue Manager. 
  • Types of Messages Queues are: 
    • Local Queue – is a real queue
    • Cluster Queue – is a local queue that is known throughout a cluster of queue managers. 
    • Remote Queue – structure describing a queue hosted by a different queue manager. 
    • Transmission Queue – a local queue used for messages to be sent to a remote queue. 
    • Initiation Queue – local queue with a special purpose 
    • Dynamic Queue – local queue created on the fly 
    • Alias Queue – if you do not like the queue name 
    • Dead-Letter Queue – one for each queue manager 
    • Reply-to Queue – specified in request message 
    • Model Queue – model for local queues 
    • Repository Queue – hold cluster information