I am using a default IBM mq topic 'dev/' and have a durable subscriber attached to this topic. Using a JMS Producer client if I produce some message but do not consume them, they are held in the subscription for the durable client.
So I want to check the message count for that subscription using MQSC Command, I'm able to check it using MQ Explorer in the status of the subscription, but want to check it via command line, using MQSC. So far I've got
DISPLAY SUB('JMS:QM1:LOCALDB.vanshaj.pump_fs_ns_Pump:LOCALDB.vanshaj.pump_fs_ns_Pump') ALL
but this only displays the following property
AMQ8096I: IBM MQ subscription inquired.
SUBID(414D5120514D31202020202020202020CDBBF261053D4321)
SUB(JMS:QM1:LOCALDB.vanshaj.pump_fs_ns_Pump:LOCALDB.vanshaj.pump_fs_ns_Pump)
TOPICSTR(dev/) TOPICOBJ( )
DISTYPE(RESOLVED)
DEST(SYSTEM.MANAGED.DURABLE.61F2BBCD21433D04)
DESTQMGR(QM1) PUBAPPID( )
SELECTOR( ) SELTYPE(NONE)
USERDATA( )
PUBACCT(0000000000000000000000000000000000000000000000000000000000000000)
DESTCORL(414D5120514D31202020202020202020CDBBF261053D4321)
DESTCLAS(MANAGED) DURABLE(YES)
EXPIRY(UNLIMITED) PSPROP(MSGPROP)
PUBPRTY(ASPUB) REQONLY(NO)
SUBSCOPE(ALL) SUBLEVEL(1)
SUBTYPE(API) VARUSER(ANY)
WSCHEMA(TOPIC) SUBUSER(app)
CRDATE(2022-01-28) CRTIME(12:11:30)
ALTDATE(2022-01-28) ALTTIME(12:14:14)
what I need is the message count which can be seen in the below image
IBM MQ subscriptions are each associated with a queue that is used to hold the messages. The queue is displayed in the DEST
field of the subscription. In your example the queue name is SYSTEM.MANAGED.DURABLE.61F2BBCD21433D04
.
If you want to view the count of unconsumed messages you will need to display the CURDEPTH
of the queue associated with the subscription, for example:
DIS QLOCAL(SYSTEM.MANAGED.DURABLE.61F2BBCD21433D04) CURDEPTH
The output will look something like this:
AMQ8409I: Display Queue details.
QUEUE(SYSTEM.MANAGED.DURABLE.61F2BBCD21433D04)
TYPE(QLOCAL) CURDEPTH(128)
IBM MQ managed subscriptions (all JMS subscriptions are manged since you are unable to specify your own queue to use) will have name in the following format:
For nondurable subscriptions:
SYSTEM.MANAGED.NDURABLE.*
For durable subscriptions:
SYSTEM.MANAGED.DURABLE.*
If you are interested in all managed subscriptions with unconsumed messages you can use this command:
DIS QLOCAL(SYSTEM.MANAGED.*) WHERE(CURDEPTH GT 0)