Websphere MQ – Copy messages between queues

by luca
0 comment

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.

qload’s source code is available on Github, in the ibm-messaging repository.

Let’s see some examples of its usage:


  • move all the messages from queue IN.QUEUE to queue OUT.QUEUE, qmanager QM.TEST




  • copy all the messages from queue IN.QUEUE to queue OUT.QUEUE,qmanager QM.TEST


./qload -m QM.TEXT -i IN.QUEUE -o OUT.QUEUE


  • save all the messages in queue IN.QUEUE, qmanager QM.TEST, to the file msgs.txt


./qload -m QM.TEXT -i IN.QUEUE -f msgs.txt


  • load all the messages from file msgs.txt to queue IN.QUEUE,qmanager QM.TEST


./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.

Related Posts

Leave a Comment

twelve − ten =