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
no more messages
Sample AMQSGBR0 (browse) end
No comments:
Post a Comment