Поделиться через


Moving Messages from a Message Queuing System to a Foreign Messaging System

 

Applies To: Windows 10, Windows 7, Windows 8, Windows 8.1, Windows Server 2008, Windows Server 2008 R2, Windows Server 2012, Windows Server 2012 R2, Windows Server Technical Preview, Windows Vista

To move messages to a foreign messaging 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 nontransactional messages are stored in the nontransactional connector queue.

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 nontransactional queue, and the second opens the transactional queue.

MQOpenQueue("CONNECTOR=ForeignCNGUID",     // Special format name  
    MQ_RECEIVE_ACCESS,                     // Receive access  
    MQ_DENY_RECEIVE_SHARE,                 // Read Exclusive  
    qh                                     // Returned queue handle  
    )  
  
MQOpenQueue("CONNECTOR=ForeignCNGUID;XACTONLY",  // Format name  
    MQ_RECEIVE_ACCESS,                           // Receive access  
    MQ_DENY_RECEIVE_SHARE,                       // Read Exclusive  
    qh                                           // Returned handle  
    )  

An application can find the GUID of a foreign CN or foreign site by calling MQGetMachineProperties and retrieving PROPID_QM_CONNECTION.

For each message received, the connector application creates a message translated into a form understood by the foreign messaging system using the information read from the original message to set the message properties. The sending application can store information that is needed to set foreign message properties that are not supported by the Message Queuing system in the extension property (PROPID_M_EXTENSION and PROPID_M_EXTENSION_LEN or MSMQMessage.Extension). The translated message is then sent to the Message Queuing queue using functions of the foreign messaging system.