Thursday 3 March 2016

The WebSphere MQ Queue Load / Unload Utility

How to Load/UnLoad messages from Websphere MQ Queues Using Qload & Unload Utility

The WebSphere MQ Queue Load / Unload Utility allows the user to copy or move the contents of a queue, its messages, to a file. This file can be saved away as required and used at some later point to reload the messages back onto the queue. This file has a specific format understood by the utility, but is human-readable, so that it can be updated in an editor before being reloaded.

Create Queue Manager:
 crtmqm QM1
start Queue mqnqger:
strmqm QM1
Create local queues:
runmqsc QM1
DEFINE QLOCAL(Q1)
DEFINE QLOCAL(Q2)

Put 10 messages into queue1

Sample Commands :

1. Backup messages from a Queue to a file:
 qload –m QM1 –i Q1 –f /tmp/bkpmsg

2. import messages from a file to the queue:
qload –m QM1 –o LQ1 –f /tmp/bkpmsg

3. Copying messages from a queue to another queue:
qload –m QM1 –i Q1 –o Q2

4. Copying certain number of messages from a queue to another queue:
(e.g) we need to copy first 15 messages from a Q1 to Q2
qload –m QM1 –i Q1 –o Q2 –r#20

“-r” Parameter:
x  =  Process x messages only
x..y  =  Process messages between x and y
X#y  =  Process messages from x to y count
#y  =  Process first y count of messages (just like in e.g)

5. Move entire message from a queue to another queue:
qload –m QM1 –i Q1 –o Q2

6. Unload and remove 10 messages, starting at message 530:

qload –m QM1 –I Q1 –f /tmp/bkpmsg –dA –r53#10

7.Unload and remove messages from 43 to 52:

qload –m QM1 –I Q1 –f /tmp/bkpmsg –dA –r43..52

No messages are removed from the queue as the lower case “i” instructs qload to use browse.

8.Unload and remove first message on queue Q1, with deletion:


qload –m QM1 –I Q1 –f /tmp/bkpmsg –dA –r1

No comments: