IBM Support has a technical note labeled Does MQ have a feature to generate automatically a duplicate message?.
The options listed on that page are to use Pub/Sub or programs qload and dmpmqmsg. You can also use MQ Visual Edit and MQ Batch Toolkit to get messages from a queue and write the message to a file. You can even use the open source programs Message Multiplexer (MMX) and/or Msg2File to do it too.
The problem with these programs is that if there are getters (applications performing MQGET API calls) then those programs will NOT capture all of the messages flowing through the queue.
The Pub/Sub solution is ok IF the user does not care about duplicating the message’s MQMD fields. The instructions on this page labeled MQ: You want to put a message into a queue and you want to generate duplicate messages into other queues has the following warning:
NOTE: Strictly speaking, the messages received by Q1 and Q2 are NOT truly identical. Even though they will have the same payload (text string ‘TEST’) and same characteristics, each message will have its own unique message-id.
Notice that the only differences in this particular example are the last 2 characters from “MsgId” and CorrelId”.
The only true solution to EXACTLY replicate a message and its MQMD fields is Capitalware’s MQ Message Replication (MQMR). MQMR will duplicate/clone messages being written (via MQPUT or MQPUT1 API calls) to an application’s output queue and MQMR will write the exact same messages to ‘n’ target queues (‘n’ can be up to 100). When MQMR replicates a message both the message data and the message’s MQMD structure will be cloned. This means that the fields of the MQMD structure (i.e. PutTime, MessageId, CorrelId, UserId, etc..) will be exactly the same as the original message’s MQMD structure.
MQMR can clone messages being written to any MQ queue type. i.e. local, alias, remote and/or cluster queues (including transmission queues).
Existing applications do not need to be modified or updated nor is it necessary to set up Publish/Subscribe to use MQMR. MQMR is deployed and configured at the queue manager level; hence, no application changes are required.
MQMR includes 2 auxiliary programs to help with the management of the cloned/replicated messages:
- MQ Queue To SQLite DB (MQ2SDB) program will offload MQ messages to an SQLite database.
- SQLite DB To MQ Queue (SDB2MQ) program will load SQLite database rows into messages in an MQ queue.
Capitalware offers free trials of MQMR including free support, so if anyone would like to try out MQMR then send the email to support@capitalware.com
Regards,
Roger Lacroix
Capitalware Inc.