Compartir a través de


PROPID_M_CORRELATIONID

A version of this page is also available for

Windows Embedded CE 6.0 R3

4/8/2010

This property specifies the correlation identifier of the message.

  • Type Indicator
    VT_VECTOR | VT_UI1
  • PROPVARIANT Field
    caub
  • Property Values
    Application-defined message identifier.

    Default is 0.

    Maximum length is 20 bytes.

Remarks

When sending a message, PROPID_M_CORRELATIONID provides an application-defined identifier that the receiving application can use to sort messages.

To set the correlation identifier of a message, specify PROPID_M_CORRELATIONIDin the MQMSGPROPS structure and call MQSendMessage.

To retrieve the correlation identifier of a message, specify PROPID_M_CORRELATIONIDin the MQMSGPROPS structure. Then call MQReceiveMessage and examine its returned value.

When sending response messages to the sending application, PROPID_M_CORRELATIONID can be set to the message identifier (PROPID_M_MSGID) of the message that is in the queue. This provides an easy mechanism that the sending application can use to match the response message with the message that was sent.

When MSMQ generates an acknowledgment message, it uses the PROPID_M_CORRELATIONID property to specify the message identifier of the original message.

The application retrieving the acknowledgment messages can then use PROPID_M_CORRELATIONID to identify the original message associated with the acknowledgment message.

When sending messages to a foreign queue, the value of PROPID_M_CORRELATIONID is used to verify the sender's signature.

Examples

This example shows how PROPID_M_CORRELATIONID is specified in the MQMSGPROPS structure.

UCHAR szCorrelationID[20];
aMsgPropId[i] = PROPID_M_CORRELATION;      // Property ID
aMsgPropVar[i].vt = VT_VECTOR | VT_UI1; // Type indicator
aMsgPropVar[i].caub.pElems = szCorrelationID;
aMsgPropVar[i].caub.cElems = sizeof(szCorrelationID);
i++;

Note

OS versions prior to 2.12 require the MSMQ add-on pack.

Requirements

Header mq.h
Windows Embedded CE Windows CE 2.0 and later
Windows Mobile Windows Mobile Version 5.0 and later

See Also

Reference

MQReceiveMessage
MQSendMessage
PROPID_M_MSGID
MQMSGPROPS