Professional Documents
Culture Documents
1. INTRODUCTION
2. INTERCOMMUNICATION
3. CLUSTERING
4. TRIGGERING
5. SSL
6. CLIENT-SERVER COMMUNICATION
7. MULTI INSTANCE QUEUE MANAGER
8. BACKING UP AND RESTORING A QUEUE MANAGER
9. PUBLISH AND SUBSCRIBE
1.INTRODUCTION
MQ runs via message queuing wherein application programs communicate by writing and
receiving data to and from queues without necessarily having a link between them. This enables
programs to run on different machines but in different platforms. Applications can also be written in
different languages and can be transferred seamlessly from one platform to another.
2. INTERCOMMUNICATION
Intercommunication means sending messages from one queue manager to another. The
receiving queue manager can be on the same machine or another.
3. CLUSTERING
Clustering is a way to logically group the Queue Managers. A cluster is a group of queue
managers set up in such a way that the queue managers can communicate directly with one another
over a single network, without the need for complex transmission queue, channel, and queue
definitions. The main advantage of clustering is work load balancing. If one system in the cluster fails
the other system having the full repositories can take control.
Cluster Configuration:
Here we create two queue managers A,B which hold full repositories and queue manager C
which hold partial repositories.
QMGR A
Create a Queue manger ‘A’ using command
crtmqm A
Start the queue manager using command
strmqm A
Run the Queue manager using the command
runmqsc A
Inside the A
Create a Listener using command
DEFINE LISTENER(LIST1) TRPTYPE(TCP) PORT(1414)
Start the Listener using command
START LISTENER(LIST1)
Check the Listener status to check if it started or not
DIS LSSTATUS(LIST1)
Create a Local Queue
DEFINE QLOCAL(INVNETQ) CLUSTER(INVENTORY)
Alter queue manager repositories using command
ALTER QMGR REPOS(INVENTORY)
Create a Cluster-Receiver Channel
DEFINE CHANNEL(TO.A) CHLTYPE(CLUSRCVR) TRPTYPE(TCP)
CONNAME('LOCALHOST(1416)') CLUSTER(INVENTORY)
Create a Cluster-Sender Channel
DEFINE CHANNEL(TO.C) CHLTYPE(CLUSSDR) TRPTYPE(TCP)
CONNAME('LOCALHOST(1414)') CLUSTER(INVENTORY)
Start Sender Channel
START CHL(TO.C)
END
QMGR B
Create a Queue manger ‘B’ using command
crtmqm B
Start the queue manager using command
strmqm B
Run the Queue manager using the command
runmqsc B
Inside the B
Create a Listener using command
DEFINE LISTENER(LIST1) TRPTYPE(TCP) PORT(1415)
Start the Listener using command
START LISTENER(LIST1)
Check the Listener status to check if it started or not
DIS LSSTATUS(LIST1)
Create a Local Queue
DEFINE QLOCAL(INVNETQ) CLUSTER(INVENTORY)
Alter queue manager repositories using command
ALTER QMGR REPOS(INVENTORY)
Create a Cluster-Receiver Channel
DEFINE CHANNEL(TO.B) CHLTYPE(CLUSRCVR) TRPTYPE(TCP)
CONNAME('LOCALHOST(1416)') CLUSTER(INVENTORY)
Create a Cluster-Sender Channel
DEFINE CHANNEL(TO.C) CHLTYPE(CLUSSDR) TRPTYPE(TCP)
CONNAME('LOCALHOST(1415)') CLUSTER(INVENTORY)
Start the Sender Channel
START CHL(TO.C)
END
QMGR C
Create a Queue manger ‘C’ using command
crtmqm C
Start the queue manager using command
strmqm C
Run the Queue manager using the command
runmqsc C
Inside the C
Create a Listener using command
DEFINE LISTENER(LIST1) TRPTYPE(TCP) PORT(1416)
Start the Listener using command
START LISTENER(LIST1)
Check the Listener status to check if it started or not
DIS LSSTATUS(LIST1)
Alter queue manager repositories using command
ALTER QMGR REPOS(INVENTORY)
Create a Cluster-Receiver Channel
DEFINE CHANNEL(TO.C) CHLTYPE(CLUSRCVR) TRPTYPE(TCP)
CONNAME('LOCALHOST(1416)') CLUSTER(INVENTORY)
Create a Cluster-Sender Channel
DEFINE CHANNEL(TO.A) CHLTYPE(CLUSSDR) TRPTYPE(TCP)
CONNAME('LOCALHOST(1414)') CLUSTER(INVENTORY)
Start the Sender channel
START CHL(TO.A)
END
Working:
When we put a message on cluster queue ‘INVENTQ’ using qmgr ‘C’ the message will be
received at ‘A’ . If qmgr ‘A’ is not available it’ll be routed to qmgr ‘B’. For suppose there is a lot of
load on ‘A’ some messages will be routed to ‘B’.
4. TRIGGERING
This feature enables an Application or Channel to start automatically when ever there are
messages ready for retrieval in a queue
Triggering is of two types
Application Triggering
Channel Triggering
4.1 Application Triggering:
Create a Queue manger ‘A’ using command
crtmqm A
Start the queue manager using command
strmqm A
Run the Queue manager using the command
runmqsc A
Inside the 'A'
Create a Listener using command
DEFINE LISTENER(LIST1) TRPTYPE(TCP) PORT(1414)
Start the Listener using command
START LISTENER(LIST1)
Check the Listener status to check if it started or not
DIS LSSTATUS(LIST1)
Create a Local Queue
DEFINE QLOCAL(INPUTQ)
Alter Local Queue
ALTER QLOCAL(INPUTQ) TRIGGER TRIGTYPE(EVERY)
INITQ(SYSTEM.DEFAULT.INITIATION.QUEUE) PROCESS(PROC)
Create a file ‘app.txt’ in ‘/tmp’ folder
cd /tmp
vi app.txt
(add the following line to app.txt)
/opt/mqm/samp/bin/amqsget INPUTQ A >> /tmp/out.txt
Run qmgr A
runmqsc A
Inside ‘A’
Create a Process
DEFINE PROCESS(PROC) APPLTYPE(UNIX) APPLICID(‘/tmp/app.txt’)
END
Switch user as ‘mqm’
Run the following command
runmqtrm –m A –q SYSTEM.DEFAULT.INITIATION.QUEUE
Open new terminal
Put the message
./amqsput INPUTQ A
To see the message open ‘out.txt’ file
QMGR B
Create a Queue manger ‘B’ using command
crtmqm B
Start the queue manager using command
strmqm B
Run the Queue manager using the command
runmqsc B
Inside 'B'
Define a Transmission Queue
DEFINE QL(B.LQ)
Define Receiver channel
DEFINE CHL(A.TO.B) CHLTYPE(TCP) TRPTYPE(TCP)
Testing:
Run the following command
runmqchi -m A -q SYSTEM.CHANELL.INITQ
Now check the channel status they will be in running state
5. SSL
Secure Sockets Layer (SSL) is a protocol designed to allow the transmission of secure data over
an insecure network. SSL makes use of digital certificates to enable authentication between client and
server.
In client-server communication a connection is established between client and server. Here the
client and server can be on the same host or two different hosts. The messages can be send
bidirectionally between client and server.
7.3 Testing:
First start the QM1 in the Server1
strmqm –x QM1
Now try to start QM1 on Server2.It will start as stand by
strmqm –x QM1
When you stop the qmgr on Server1 then Server to will get active and will be in running state
Having a backup of a queue manager is essential because when hardware failure occurs we can
restore the lost data.
8.1 Backing up:
Download MS03 file from internet
ms03_unix.tar.z
Extract file ms03_unix.tar.z
Create a file in tmp QM1.MQSC
Change permissions if the file
chmod - R 777 QM1.MQSC
run the command in downloads to backup qmgr
./saveqmgr.linux -m QM1 -f /tmp/QM1.MQSC
start the queue manager
strmqm QM1
8.2 Restoring:
first delete the qmgr
dltmqm QM1
create the qmgr
crtmqm QM1
start the qmgr
strmqm QM1
to restore the backup file
runmqsc QM1 </tmp/QM1.MQSC
check the queues or channels
Enter the message to be published and press publish. Select queues next right click on the local queue
and select browse message. Similarly create more topics and more subscribers.