Partager via


PROPID_M_MSGID (Windows Embedded CE 6.0)

1/6/2010

This property indicates the MSMQ-generated identifier of the message.

  • Type Indicator
    VT_VECTOR | VT_UI1
  • PROPVARIANT Field
    caub
  • Property Values
    20-byte MSMQ-generated message identifier.

Remarks

MSMQ generates a 20-byte message identifier when the message is sent.

This identifier is composed of the following:

  • The machine globally unique identifier (GUID) of the computer that sent the message
  • An identifier that uniquely identifies each message on the computer

By combining these pieces, the message identifier is unique within your enterprise.

MSMQ generates message identifiers for all messages, including acknowledgment messages generated by MSMQ and MSMQ connector applications. When an acknowledgment message is created, the identifier of the original message can be found in the PROPID_M_CORRELATIONID property of the acknowledgment message.

The message identifier is an array of bytes that can be read by the sending or receiving application.

To retrieve the identifier of a message, specify PROPID_M_MSGID in the MQMSGPROPS structure. Then call MQSendMessage or MQReceiveMessage and examine the returned identifier.

This property can also be used when sending response messages. For example, the application creating the response message can set the correlation identifier (PROPID_M_CORRELATIONID) of the response message to the identifier of the message it read from the queue. This gives the application reading the response message a way to know which message the response is referring to.

Examples

The following example shows how PROPID_M_MSGID is specified in the MQMSGPROPS structure for retrieving the identifier of a message.

BYTE MessageID[PROPID_M_MSGID_SIZE];
MsgProps.aPropID[i] = PROPID_M_MSGID;                 // Property ID
MsgProps.aPropVar[i].vt = VT_VECTOR|VT_UI1;          // Type indicator
MsgProps.aPropVar[i].caub.pElems = MessageID;
MsgProps.aPropVar[i].caub.cElems = sizeof(MessageID);
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

See Also

Reference

MSMQ Properties
MQReceiveMessage
MQSendMessage
PROPID_M_CORRELATIONID
MQMSGPROPS