If you administer a Websphere MQ server, it may happen that someone ask you to manage the messages: create a backup, move messages from a queue to another one…
The main administration tool for WMQ, MQ Explorer, doesn’t support those operations; you can only browse the queues or send test messages:
I recently discovered a tool, freely released by IBM, named qload. This tool allows to move/copy messages between queues or transfer them between a queue and a text file.
Let’s see some examples of its usage:
[checklist]
- move all the messages from queue IN.QUEUE to queue OUT.QUEUE, qmanager QM.TEST
[/checklist]
./qload -m QM.TEXT -I IN.QUEUE -o OUT.QUEUE
[checklist]
- copy all the messages from queue IN.QUEUE to queue OUT.QUEUE,qmanager QM.TEST
[/checklist]
./qload -m QM.TEXT -i IN.QUEUE -o OUT.QUEUE
[checklist]
- save all the messages in queue IN.QUEUE, qmanager QM.TEST, to the file msgs.txt
[/checklist]
./qload -m QM.TEXT -i IN.QUEUE -f msgs.txt
[checklist]
- load all the messages from file msgs.txt to queue IN.QUEUE,qmanager QM.TEST
[/checklist]
./qload -m QM.TEXT -o IN.QUEUE -f msgs.txt
It’s of course possible to filter the messages. For example the parameter -r allows to specify the number of the message or the range of messages to be included in the action:
./qload -m QM.TEXT -i IN.QUEUE -f msgs.txt -r 10..15
saves in the file msgs.txt only messages with index between 10 and 15.