Publish/subscribe hierarchy scenario 2: Using point-to-point channels with same name for transmission queue and remote queue manager
This is the second in a set of three scenarios that set up a publish/subscribe hierarchy in different ways to establish the connection between queue managers. This scenario sets up a publish/subscribe hierarchy that uses point-to-point channels with the transmission queue name the same as the remote queue manager.
This set of scenarios all use a parent queue manager called QM1, and two child queue managers called QM2, and QM3.
Scenario 2 is split into smaller sections to make the process easier to follow. This scenario reuses Scenario 1 part 1, Scenario 1 part 3, and Scenario 1 part 4 from Publish/subscribe hierarchy scenario 1: Using point-to-point channels with queue manager name alias.
Scenario 2 part 1: Create queue manager and set PSMODE
Procedure
-
Create and start three queue managers called QM1, QM2, and QM3 using the following commands:
crtmqm -u SYSTEM.DEAD.LETTER.QUEUE QM1 strmqm QM1 crtmqm -u SYSTEM.DEAD.LETTER.QUEUE QM2 strmqm QM2 crtmqm -u SYSTEM.DEAD.LETTER.QUEUE QM3 strmqm QM3
-
Enable the queue manager publish/subscribe mode by using the following command on all three queue managers:
ALTER QMGR PSMODE(ENABLED)
Scenario 2 part 2: Point-to-point channel connections
About this task
Establish point-to-point channel connections between a queue manager using a transmission queue with the same name as the parent queue manager.
Procedure
-
Define a transmission queue on QM2 to QM1. Define a sender channel to QM1 and a receiver channel for the sender channel for QM2 created on QM1:
DEFINE QLOCAL(QM1) USAGE(XMITQ) DEFINE CHANNEL('QM2.TO.QM1') CHLTYPE(SDR) CONNAME('localhost(9999)') XMITQ(QM1) TRPTYPE(TCP) DEFINE CHANNEL('QM1.TO.QM2') CHLTYPE(RCVR) TRPTYPE(TCP)
-
Define a transmission queue on QM3 to QM1. Define sender channel to QM1 and a receiver channel for the sender channel created on QM1 for QM3:
DEFINE QLOCAL(QM1) USAGE(XMITQ) DEFINE CHANNEL('QM3.TO.QM1') CHLTYPE(SDR) CONNAME('localhost(9999)') XMITQ(QM1) TRPTYPE(TCP) DEFINE CHANNEL('QM1.TO.QM3') CHLTYPE(RCVR) TRPTYPE(TCP)
-
Define transmission queues on QM1 to QM2 and QM3. Define sender channels to QM2 and QM3, and a receiver channel for the sender channels created on QM2 and QM3 for QM1:
DEFINE QLOCAL(QM2) USAGE(XMITQ) DEFINE CHANNEL('QM1.TO.QM2') CHLTYPE(SDR) CONNAME('localhost(7777)') XMITQ(QM2) TRPTYPE(TCP) DEFINE CHANNEL('QM2.TO.QM1') CHLTYPE(RCVR) TRPTYPE(TCP) DEFINE QLOCAL(QM3) USAGE(XMITQ) DEFINE CHANNEL('QM1.TO.QM3') CHLTYPE(SDR) CONNAME('localhost(8888)') XMITQ(QM3) TRPTYPE(TCP) DEFINE CHANNEL('QM3.TO.QM1') CHLTYPE(RCVR) TRPTYPE(TCP)
-
Start the appropriate listeners on the queue managers:
runmqlsr -m QM1 -t TCP -p 9999 & runmqlsr -m QM2 -t TCP -p 7777 & runmqlsr -m QM3 -t TCP -p 8888 &
-
Start the following channels:
- On QM1:
START CHANNEL('QM1.TO.QM2') START CHANNEL('QM1.TO.QM3')
- On QM2:
START CHANNEL('QM2.TO.QM1')
- On QM3:
START CHANNEL('QM3.TO.QM1')
- On QM1:
-
Check that all the channels have started:
DISPLAY CHSTATUS('QM1.TO.QM2') DISPLAY CHSTATUS('QM1.TO.QM3') DISPLAY CHSTATUS('QM2.TO.QM1') DISPLAY CHSTATUS('QM3.TO.QM1')
Scenario 2 part 3: Connect queue managers and define a topic
About this task
Connect the child queue managers QM2 and QM3 to the parent queue manager QM1.
Procedure
-
On QM2 and QM3, set the parent queue manager to QM1:
ALTER QMGR PARENT (QM1)
-
Run the following command on all queue managers to check that the child queue managers are connected to the parent queue manager:
DISPLAY PUBSUB TYPE(ALL)
Command output is displayed. For example, here is output for QM1, with the key details highlighted:DISPLAY PUBSUB ALL 1 : DISPLAY PUBSUB ALL AMQ8723: Display pub/sub status details. QMNAME(QM1) TYPE(LOCAL) STATUS(ACTIVE) SUBCOUNT(6) TPCOUNT(9) AMQ8723: Display pub/sub status details. QMNAME(QM2) TYPE(CHILD) STATUS(ACTIVE) SUBCOUNT(NONE) TPCOUNT(NONE) AMQ8723: Display pub/sub status details. QMNAME(QM3) TYPE(CHILD) STATUS(ACTIVE) SUBCOUNT(NONE) TPCOUNT(NONE)
Scenario 2 part 4: Publish and subscribe the topic
About this task
Use the amqspub.exe and amqssub.exe applications to publish and subscribe the topic.
Procedure
-
Run this command in the first command window:
amqspub Sport/Soccer QM2
-
Run this command in the second command window:
amqssub Sport/Soccer QM1
-
Run this command in the third command window:
amqssub Sport/Soccer QM3
Results
The amqssub.exe applications in the second and third command windows receive the messages published in the first command window.