Bootstrap FreeKB - IBM MQ - Reprocess messages in SYSTEM.DEAD.LETTER.QUEUE using the runmqdlq command
IBM MQ - Reprocess messages in SYSTEM.DEAD.LETTER.QUEUE using the runmqdlq command

Updated:   |  IBM MQ articles

The runmqdlq (run dead letter queue handler) command can be used to attempt to resend messages in a dead letter queue, such as SYSTEM.DEAD.LETTER.QUEUE, to their intended queues. Before attempting to resend messages to their intended queues, you will probably want to determine how many messages are in the dead letter queue.

~]# echo "display queue (SYSTEM.DEAD.LETTER.QUEUE) CURDEPTH" | runmqsc MANAGER01
   QUEUE(SYSTEM.DEAD.LETTER.QUEUE)         TYPE(QLOCAL)
   CURDEPTH(100)

 

You will probably also want to use the amqsbcg command to determine the queues that the messages were intended for.

amqsbcg SYSTEM.DEAD.LETTER.QUEUE MANAGER01

 

The output will include a binary block. Look closely. Notice the destination queue in QUEUE01.

00000000:  0700 0000 2400 0000 0100 0000 2C00 0000 'RFH.............'
00000010:  0100 0000 0100 0000 0100 0000 AE08 0000 '....MQSTR   ....'
00000020:  0100 0000 0400 0000 4400 0000 DF07 0000 '........<mcd><Ms'
00000030:  0000 0000 3000 0000 7361 7475 726E 2E71 'd>jms_text</Msd>'
00000040:  7565 7565 2E6D 616E 6167 6572 2020 2020 '</mcd>  ...L<jms'
00000050:  2020 2020 2020 2020 2020 2020 2020 2020 '><Dst>queue:///Q'
00000060:  2020 2020 2020 2020 2020 2020 2020 2020 'UEUE01</Dst><Tms'
00000070:  2020 2020 2020 2020 2020 2020 2020 2020 '>1552628162482</'
00000080:  2020 2020 2020 2020 2020 2020 2020 2020 'Tms><Dlv>2</Dlv>'
00000090:  2020 2020 2020 2020 2020 2020 2020 2020 '</jms>  Hello Wo'
00000100:  2020 2020 2020 2020 2020 2020 2020 2020 'rld             '

 

In this example, since the messages were intended for QUEUE01, you'll want to make sure that the CURDEPTH (current depth) of QUEUE01 has not reached it's MAXDEPTH.

~]$ echo "display queue (QUEUE01) CURDEPTH MAXDEPTH" | runmqsc MQHUBVA1    
   QUEUE(QUEUE01)          TYPE(QLOCAL)
   CURDEPTH(12)            MAXDEPTH(5000)

 

If the CURDEPTH has reached the MAXDEPTH, you may want to increase the MAXDEPTH so that the messages in the dead letter queue can be reprocessed onto QUEUE01.

echo "alter qlocal (QUEUE01) MAXDEPTH (10000)" | runmqsc MANAGER01

 

The which command (on Linux) can be used to ensure that the runmqdlq can be found in your $PATH and to determine the location of the runmqdlq command.

which runmqdlq

 

Something like this should be returned.

/bin/runmqdlq

 

Typically, a file is created that contains the rules that will be used by the runmqdlq command. 

touch rules.txt

 

Here is an example of what could be in the file.

WAIT(NO)
ACTION(RETRY)

 

Here is an example of how runmqdlq can be invoked to attempt to resend the messages in SYSTEM.DEAD.LETTER.QUEUE to their intended queue. In this example, MANAGER01 is the name of the queue manager. The dspmq (display queue manager) command can be used to list the queue managers.

runmqdlq SYSTEM.DEAD.LETTER.QUEUE MANAGER01 < rules.txt

 

Or better yet, this could be done without having to use a file.

echo -e "WAIT(NO)\nACTION(RETRY)" | runmqdlq SYSTEM.DEAD.LETTER.QUEUE MANAGER01

 

Something like this should be displayed.

09/15/2020  10:49:31 PM  AMQ8708I: Dead-letter queue handler started to process INPUTQ(SYSTEM.DEAD.LETTER.QUEUE).
09/15/2020  10:49:42 PM  AMQ8709I: Dead-letter queue handler ending.

 

After this is done, I would use the display queue command to see if the CURDEPTH (current depth) of SYSTEM.DEAD.LETTER.QUEUE is 0, which means the messages were sent to their intended queue.

~]# echo "display queue (SYSTEM.DEAD.LETTER.QUEUE) CURDEPTH" | runmqsc MANAGER01
   QUEUE(SYSTEM.DEAD.LETTER.QUEUE)         TYPE(QLOCAL)
   CURDEPTH(0)

 




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 74fa3c in the box below so that we can be sure you are a human.