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 the distributed publish/subscribe network.

Scenario 3 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.

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.

Figure 1. Topology diagram showing the relationship between queue managers that are using a cluster channel.


Scenario 3 part 1: Create queue manager and set PSMODE

Procedure

  1. 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
    
  2. Enable the queue manager publish/subscribe mode by using the following command on all three queue managers:
    ALTER QMGR PSMODE(ENABLED)
    


Scenario 3 part 2: Point-to-point channel connections

About this task

Establish point-to-point channel connections between queue managers a cluster.

Procedure

  1. On QM1 and QM2, set the REPOS parameter to the name of the cluster DEMO:
    ALTER QMGR REPOS(DEMO)
    
  2. 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 &
    
  3. Define the cluster receiver channel on each queue manager:
    1. On QM1:
      DEFINE CHANNEL(TO.QM1) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('localhost(9999)') CLUSTER(DEMO)
      
    2. On QM2:
      DEFINE CHANNEL(TO.QM2) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('localhost(7777)') CLUSTER(DEMO)
      
    3. On QM3:
      DEFINE CHANNEL(TO.QM3) CHLTYPE(CLUSRCVR) TRPTYPE(TCP) CONNAME('localhost(8888)') CLUSTER(DEMO)
      
  4. Define a cluster sender channel to a full repository on each queue manager in the cluster:
    1. On QM1:
      DEFINE CHANNEL(TO.QM2) CHLTYPE(CLUSSDR) TRPTYPE(TCP) CONNAME('localhost(7777)') CLUSTER(DEMO)
      
    2. On QM2:
      DEFINE CHANNEL(TO.QM1) CHLTYPE(CLUSSDR) TRPTYPE(TCP) CONNAME('localhost(9999)') CLUSTER(DEMO)
      
    3. 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)
      


Scenario 3 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

  1. On QM2 and QM3, set the parent queue manager to QM1:
    ALTER QMGR PARENT (QM1)
    
  2. 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 3 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

  1. Run this command in the first command window:
    amqspub Sport/Soccer QM2
    
  2. Run this command in the second command window:
    amqssub Sport/Soccer QM1
    
  3. 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.