Publish/subscribe hierarchy scenario 3: Using a cluster channel to add a queue manager
This is the third 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 uses a cluster channel to add a queue manager to a hierarchy.
This set of scenarios all use a parent queue manager called QM1, and two child queue managers called QM2, and QM3.
Note: This scenario is only using the cluster configuration to connect queue managers together, not to propagate publish/subscribe traffic through clustering topics. When defining child/parent hierarchy relationships between queue managers in the same cluster, propagation of publications between queue managers will occur based on the publication and subscription scope settings of the topics in the topic tree. It is important not to use the cluster name setting of a topic to add the topics into the cluster. If using the cluster name, the topology becomes a publish/subscribe cluster and does not require the child/parent hierarchy relationships defined. See Publish/subscribe cluster scenario and Plan for distributed publish/subscribe network.This scenario reuses steps 1, 3, and 4 from Publish/subscribe hierarchy scenario 1: Using point-to-point channels with queue manager name alias.
This scenario creates a cluster called DEMO where QM1 and QM2 are full repositories, and QM3 is a partial repository. Queue manager QM1 is the parent of queue managers QM2 and QM3.
Procedure
- Create the queue managers.
- 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)
- Create and start three queue managers called QM1,
QM2, and QM3 using the following commands:
- Establish the point-to-point channel connections between queue managers a cluster.
- On QM1 and QM2, set the REPOS
parameter to the name of the cluster DEMO:
ALTER QMGR REPOS(DEMO)
- 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 &
- Define the cluster receiver channel on each queue manager:
- On QM1:
DEFINE CHANNEL(TO.QM1) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('localhost(9999)') CLUSTER(DEMO)
- On QM2:
DEFINE CHANNEL(TO.QM2) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('localhost(7777)') CLUSTER(DEMO)
- On QM3:
DEFINE CHANNEL(TO.QM3) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('localhost(8888)') CLUSTER(DEMO)
- On QM1:
- Define a cluster sender channel to a full repository on each queue manager in the
cluster:
- On QM1:
DEFINE CHANNEL(TO.QM2) CHLTYPE(CLUSSDR) TRPTYPE(TCP) CONNAME('localhost(7777)') CLUSTER(DEMO)
- On QM2:
DEFINE CHANNEL(TO.QM1) CHLTYPE(CLUSSDR) TRPTYPE(TCP) CONNAME('localhost(9999)') CLUSTER(DEMO)
- QM3 can have a cluster sender channel to either full repository on
QM1 or QM2. This example defines the channel to
QM1:
DEFINE CHANNEL(TO.QM1) CHLTYPE(CLUSSDR) TRPTYPE(TCP) CONNAME('localhost(9999)') CLUSTER(DEMO)
- On QM1:
- On QM1 and QM2, set the REPOS
parameter to the name of the cluster DEMO:
- Connect the queue managers and define a topic. Connect the child queue
managers QM2 and QM3 to the parent queue manager
QM1.
- 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)
- On QM2 and QM3, set the parent queue manager to
QM1:
- Use the amqspub.exe and amqssub.exe
applications to publish and subscribe the topic.
- 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
- Run this command in the first command window:
Results
The amqssub.exe applications in the second and third command windows receive the messages published in the first command window.
Parent topic: Publish/subscribe hierarchy scenariosRelated tasks
- Publish/subscribe hierarchy scenario 1: Using point-to-point channels with queue manager name alias
- Publish/subscribe hierarchy scenario 2: Using point-to-point channels with same name for transmission queue and remote queue manager
Related information