共用方式為


PROPID_M_XACT_STATUS_QUEUE

 

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

(Read-only.) The PROPID_M_XACT_STATUS_QUEUE property contains a format name that identifies the transaction status queue on the source computer. It is only used by connector applications when receiving transactional messages sent to a foreign queue.

Property ID

PROPID_M_XACT_STATUS_QUEUE

Type Indicator

VT_LPWSTR

MQPROPVARIANT Field

pwszVal

Property Value

Format name of transaction status queue.

Remarks

PROPID_M_XACT_STATUS_QUEUE is set by Message Queuing. Connector applications can then retrieve the format name to send positive (read receipt) or negative acknowledgment messages back to the sending application. The transaction status queue should receive these acknowledgments even if the sending application does not request other acknowledgments.

To retrieve the format name of the transaction status queue, the connector application must specify PROPID_M_XACT_STATUS_QUEUE and PROPID_M_XACT_STATUS_QUEUE_LEN in the MQMSGPROPS structure, and then call MQReceiveMessage or MQReceiveMessageByLookupId and examine the returned values.

If MQReceiveMessage or MQReceiveMessageByLookupId fails, returning an MQ_ERROR_FORMATNAME_BUFFER_TOO_SMALL error, use the returned value of PROPID_M_XACT_STATUS_QUEUE_LEN to reallocate the format name buffer and call the applicable function again.

Equivalent COM Property

With COM components, the equivalent property for retrieving the transaction status queue is MSMQMessage.TransactionStatusQueueInfo.

For information on See
Requesting other types of acknowledgment messages PROPID_M_ACKNOWLEDGE
Transactions and connector applications Using Connector Services in a Transaction

Example Code

The following code fragment shows how PROPID_M_XACT_STATUS_QUEUE and PROPID_M_XACT_STATUS_QUEUE_LEN are specified in arrays that can be used to initialize an MQMSGPROPS structure when retrieving the format name of the transaction status queue.

ULONG ulBufferLength = 256;  
WCHAR * wszStatusQueueBuffer = NULL;  
wszStatusQueueBuffer = (WCHAR*)malloc(ulBufferLength*sizeof(WCHAR));  
if (wszStatusQueueBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(wszStatusQueueBuffer, 0, ulBufferLength*sizeof(WCHAR));  
aMsgPropId[i] = PROPID_M_XACT_STATUS_QUEUE;       // Property ID  
aMsgPropVar[i].vt = VT_LPWSTR;                    // Type indicator  
aMsgPropVar[i].pwszVal = wszStatusQueueBuffer;    // Application-defined buffer  
i++;  
  
aMsgPropId[i] = PROPID_M_XACT_STATUS_LEN;       // Property ID  
aMsgPropVar[i].vt = VT_UI4;                      // Type indicator  
aMsgPropVar[i].ulVal = ulBufferLength;  
i++;  
  
// Reallocate memory for the transaction status queue format name buffer if necessary.  
wszStatusQueueBuffer = (WCHAR*)realloc(wszStatusQueueBuffer, aMsgPropVar[1].ulVal*sizeof(WCHAR));  
if (wszStatusQueueBuffer == NULL)  
{  
  return MQ_ERROR_INSUFFICIENT_RESOURCES;  
}  
memset(wszStatusQueueBuffer, 0, aMsgPropVar[1].ulVal*sizeof(WCHAR));  
aMsgPropVar[0].pwszVal = wszStatusQueueBuffer;  // Pointer to the new buffer  

See Also

Message Properties
MQMSGPROPS
MQReceiveMessage
MQReceiveMessageByLookupId
MSMQMessage.TransactionStatusQueueInfo
PROPID_M_XACT_STATUS_QUEUE_LEN