Clearing the messages from a queue

We can clear messages from a queue without having to stop and restart the queue manager.


To clear all the messages from a queue, complete the following steps.


Procedure

  1. In the Navigator view, click the Queues folder that contains the queue. The queue is displayed in the Content view.
  2. In the Content view, right-click the queue, then click Clear Messages... The Clear Queue dialog opens.
  3. Select the method to use to clear the messages from the queue:

    • If we use the CLEAR command, all of the messages are cleared from the queue. However, if the queue is already opened exclusively by another application or if the queue contains uncommitted messages, the command fails immediately and none of the messages are cleared.
    • If we use the MQGET API call, the messages are got from the queue until no more messages are available. However, MQGET does not recognize uncommitted messages, which means that there could still be uncommitted messages on the queue. Also, the command might fail if the queue is already exclusively opened by another application.

  4. Click Clear. A message is displayed to tell you whether the command was successful.
  5. Click Close to close the dialog.


Results

All the messages are cleared from the queue unless there was a problem; for example, the queue contains uncommitted messages. Parent topic: Send test messages


Related tasks