Moving Messages from MSMQ to Another Message Queue System

To move messages to another message queue system, the connector application must read all the messages that arrive in the connector queues. All transactional messages sent to foreign queues are stored in the transactional connector queue. All non-transaction messages are stored in the non-transactional connector queue. Non-transactional and transactional messages must be read from the appropriate connector queue.

Note  For foreign message properties not supported by MSMQ, use PROPID_M_EXTENSION and PROPID_M_EXTENSION_LEN.

To open these queues, the connector application must use a specific format name.

The following example shows two MQOpenQueue calls: the first one opens the connector's non-transaction queue, and the second opens the transaction queue.

MQOpenQueue("CONNECTOR=ForeignCNGUID",     //Special format name.
    MQ_RECEIVE,                            //Receive access.
    TRUE,                                  //Read Exclusive.
    &qh                                    //Returned queue handle.
    )
 
 
MQOpenQueue("CONNECTOR=ForeignCNGUID;XACTONLY",  //Format name.
    MQ_RECEIVE,                                  //Receive access.
    TRUE,                                        //Read Exclusive.
    &qh                                          //Returned handle.
    )
 

An application can find the ForeignCNGUID from the Foreign CN name by calling MQGetMachineProperties and retrieve PROPID_QM_CONNECTION.