IBM MQ Little Gem #18: NUMMSGS + NUMPUBS

This is part of a series of small blog posts which will cover some of the smaller, perhaps less likely to be noticed, features of IBM MQ. Read other posts in this series.

When using IBM MQ's Publish/Subscribe feature you have various pieces of status information that are useful to view to see how work is progressing in your topic tree.

Subscribers

Some of the same information is presented to you in a few different ways, for example, when looking at information about your subscribers, you have the DISPAY SBSTATUS command and the DISPLAY TPSTATUS TYPE(SUB) command. These commands show the same data from slightly different perspectives, SBSTATUS starts from the subscriber and then shows you the information about the topic string that subscriber is using.

   SUB(Fruit Prices)                    
   SUBID(414D51204D5147312020202020202020A37D295820005704)
   SUBUSER(morag)                          RESMDATE(2016-11-28)
   RESMTIME(10:52:19)                      LMSGDATE(2016-11-28)
   LMSGTIME(10:54:40)                   
   ACTCONN(414D51434D5147312020202020202020A37D295820005701)
   DURABLE(YES)                            MCASTREL( , )
   NUMMSGS(7)                              SUBTYPE(API)
   TOPICSTR(Price/Fruit/#)              

TPSTATUS starts from the topic string and then shows you the information about the subscribers that are using that topic string. The command I used here was
DISPLAY TPSTATUS('Price/Fruit/#') TYPE(SUB). Remember that the wildcard you need to use on a DISPLAY TPSTATUS command is '#' or '+' and not '*'.

   TOPICSTR(Price/Fruit/Bananas)        
   SUBID(414D51204D5147312020202020202020A37D295820005704) 
   SUBUSER(morag)                          RESMDATE(2016-11-28)
   RESMTIME(10:52:19)                      LMSGDATE(2016-11-28)
   LMSGTIME(10:54:40)                   
   ACTCONN(414D51434D5147312020202020202020A37D295820005701)
   DURABLE(YES)                            SUBTYPE(API)
   MCASTREL( , )                           NUMMSGS(7) 

   TOPICSTR(Price/Fruit/Apples)         
   SUBID(414D51204D5147312020202020202020A37D295820005704) 
   SUBUSER(morag)                          RESMDATE(2016-11-28)
   RESMTIME(10:52:19)                      LMSGDATE(2016-11-28)
   LMSGTIME(10:54:40)                   
   ACTCONN(414D51434D5147312020202020202020A37D295820005701)
   DURABLE(YES)                            SUBTYPE(API)
   MCASTREL( , )                           NUMMSGS(7) 

   TOPICSTR(Price/Fruit)                
   SUBID(414D51204D5147312020202020202020A37D295820005704) 
   SUBUSER(morag)                          RESMDATE(2016-11-28)
   RESMTIME(10:52:19)                      LMSGDATE(2016-11-28)
   LMSGTIME(10:54:40)                   
   ACTCONN(414D51434D5147312020202020202020A37D295820005701)
   DURABLE(YES)                            SUBTYPE(API)
   MCASTREL( , )                           NUMMSGS(7) 

   TOPICSTR(Price/Fruit/Oranges)        
   SUBID(414D51204D5147312020202020202020A37D295820005704) 
   SUBUSER(morag)                          RESMDATE(2016-11-28)
   RESMTIME(10:52:19)                      LMSGDATE(2016-11-28)
   LMSGTIME(10:54:40)                   
   ACTCONN(414D51434D5147312020202020202020A37D295820005701)
   DURABLE(YES)                            SUBTYPE(API)
   MCASTREL( , )                           NUMMSGS(7) 

Pub/Sub FruitWhile initially you might imagine that there were four subscribers when looking at this second view, closer inspection shows that the SUBID is the same in each case. There is one subscriber that happens to be interested in these four nodes in the topic tree.

In both cases the number of messages this subscriber has received is shown - it has received 7 messages. What you cannot see from this view is on which topics did this wildcarded subscription receive the messages.

Publishers

You can also look at the status of your publishers as well. Your publishers can be seen with a
DISPLAY CONN(*) TYPE(HANDLE) WHERE(OBJTYPE EQ TOPIC) ALL
command, which just shows you which applications currently have topics open for output. This view doesn't show you any numbers of messages though.

Alternatively you can see your publishers with a DISPLAY TPSTATUS TYPE(PUB) command. The command I used here was
DISPLAY TPSTATUS('Price/Fruit/#') TYPE(PUB). Remember that the wildcard you need to use on a DISPLAY TPSTATUS command is '#' or '+' and not '*'.

   TOPICSTR(Price/Fruit/Bananas)           LPUBDATE(2016-11-28)
   LPUBTIME(10:54:40)                   
   ACTCONN(414D51434D5147312020202020202020A37D295820005A01)
   MCASTREL( , )                           NUMPUBS(4) 

   TOPICSTR(Price/Fruit/Apples)            LPUBDATE(2016-11-28)
   LPUBTIME(10:53:28)                   
   ACTCONN(414D51434D5147312020202020202020A37D295820005801)
   MCASTREL( , )                           NUMPUBS(2) 

   TOPICSTR(Price/Fruit/Oranges)           LPUBDATE(2016-11-28)
   LPUBTIME(10:53:57)                   
   ACTCONN(414D51434D5147312020202020202020A37D295820005901)
   MCASTREL( , )                           NUMPUBS(1) 

Here you can see that one particular fruit has been more active in publishing than the others. A word of warning though. This view of the numbers only collects what is happening while a publisher remains connected to the topic. Once the application closes the handle to the topic, these numbers are no longer available. So if your application uses an MQPUT1 instead of MQPUT then you'll never see this data. However, for a busy system, which is where you are most likely to be interested in such numbers, you would hope that the publisher would remain connected.

There is an RFE open to request improvement to the statistics available on the topic tree for this area. Add your vote here if you are interested.


Morag Hughson is an MQ expert. She spent 18 years in the MQ Devt organisation before taking on her current job writing MQ Technical education courses with MQGem. She also blogs for MQGem. You can connect with her here on IMWUC or on Twitter and LinkedIn.
0 Comments
1 Like
Recent Stories
IBM MQ Little Gem #20: Picking CCDT entry by Channel Name

IBM MQ Little Gem #19: DISPLAY CONN dates & times

IBM MQ Little Gem #18: NUMMSGS + NUMPUBS