次の方法で共有


PROPID_M_XACTID (Compact 2013)

3/26/2014

This property indicates which transaction sent the message.

When you specify this property in aPropID, set the following values for aPropVar:

  • MQPROPVARIANT.vt
    VT_VECTOR | VT_UI1
  • MQPROPVARIANT.caub
    The counted array of other data types.

Property Value

Identifier of the transaction.

Remarks

This property is available for MSMQ 2.0, MSMQ 3.0, and MSMQ 4.0.

It is used by receiving applications to verify that a message was sent from a specific transaction.

The transaction identifier is a 20-byte identifier that includes the following:

  • The computer identifier of the sending machine (the first 16 bits).
  • A transaction sequence number (the last 4 bytes).

Transaction identifiers are not guaranteed to be unique because the transaction sequence numbers are not persistent and they start over again at 2^20.

Message Queuing guarantees only that subsequent transactions will have different transaction sequence numbers.

To verify transaction boundaries, use PROPID_M_XACTID with the following properties:

Examples

The following code example shows how PROPID_M_XACTID is specified in the MQMSGPROPS structure.

Important

For readability, the following code example does not contain security checking or error handling. Do not use the following code in a production environment.

DWORD dwIdBufferSize = 1024;
UCHAR *pucIdBuffer = (UCHAR *)malloc(dwIdBufferSize);
if (pucIdBuffer == NULL) {
    // Error handling code (not included for clarity)
}
aPropId[i] = PROPID_M_XACTID;    // Property ID
aPropVar[i].vt = VT_VECTOR|VT_UI1;      // Type indicator
aPropVar[i].caub.pElems = (UCHAR*)pucIdBuffer;
aPropVar[i].caub.cElems = dwIdBufferSize;
i++;

See Also

Reference

MSMQ Properties
PROPID_M_LAST_IN_XACT