Sending the same message to two or more queues using the Q program

During development of integration solutions I often find it useful to send the same message too two or more different queues. Doing this with the Q-program (ma01) is really easy since it can do this natively

q -m MYQMGR -I MYINQ -o MYOUTQ1 -o MYOUTQ2

This will move all messages from MYINQ and put them on both MYOUTQ1 and MYOUTQ2 on q manager MYQMGR. The trick is to use multiple -o options. The Q program will put the messages on all the queues listed.

To copy instead of move change the -I to -i like this:

q -m MYQMGR -i MYINQ -o MYOUTQ1 -o MYOUTQ2

This will leave the messages on MYINQ and only copy them to MYOUTQ1 and MYOUTQ2

Comments are closed.

Niklas Tech Blog
Privacy Overview

This website uses cookies so that we can provide you with the best user experience possible. Cookie information is stored in your browser and performs functions such as recognising you when you return to our website and helping our team to understand which sections of the website you find most interesting and useful.