FreeKB - IBM MQ Purge messages in a queue using the amqsget command
IBM MQ - Purge messages in a queue using the amqsget command

The amqsget command can be used to GET the messages in the queue. If your goal is to remove all of the messages in a queue, the clear queue command is probably a better option.

Before using the amqsget command to get the messages in a queue, you may want to use the display queue command to display the number of messages in the queue.

echo "display queue (QUEUE01) CURDEPTH" | runmqsc MANAGER01

 

In this example, the current depth of queue01 is 10.

QUEUE(queue01)             TYPE(QLOCAL)
CURDEPTH(10)

 

The amqsget command can be used to GET the messages in the queue. Be aware that this will remove the message from the queue as this is a GET operation. If you are unsure of the <mq install> directory, use the dspmqinst command.

<mq install>/samp/bin/amqsget QUEUE01 MANAGER01
Sample AMQSGET0 start
message <Hello World>
Sample AMQSGET0 end

 

If there are no messages in the queue, the following will be displayed.

<mq install>/samp/bin/amqsget QUEUE01 MANAGER01
Sample AMQSGET0 start
no more messages
Sample AMQSGET0 end

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




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




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |