The PROPID_M_ACKNOWLEDGE property specifies the type of acknowledgment messages that MSMQ posts (in the administration queue) and when acknowledgments are returned to the sending application.
This can happen when the time-to-reach-queue timer expires, or when a message cannot be authenticated.
This can happen when the time-to-reach-queue timer expires, or when a message cannot be authenticated.
To receive a positive acknowledgment message when a message reaches its destination and when the message is retrieved, the following two full-acknowledgment settings must be combined using the OR operator: MQMSG_FULL_REACH_QUEUE and MQMSG_FULL_RECEIVE.
Positive and negative acknowledgments are typically MSMQ-generated messages that are sent to an administration queue specified by the message.Acknowledgment messages can also be created by MSMQ connector applications when sending messages to a foreign queue. When asking for acknowledgments, you must also specify the administration queue when you send the message (see PROPID_M_ADMIN_QUEUE). For information on administration queues, see Administration Queues.
Acknowledgment messages contain some of the information found in the original message, however, each acknowledgment message has its own message identifier and class. The message identifier, PROPID_M_MSGID, identifies the acknowledgment in the same way it identifies each message sent by an MSMQ application. The message class, PROPID_M_CLASS, identifies the type of acknowledgment that was posted. Both these properties are set by MSMQ when it creates the acknowledgment message.
To request acknowledgment messages, pass PROPID_M_ACKNOWLEDGE and PROPID_M_ADMIN_QUEUE to MQSendMessage.
To find out if an acknowledgment message was requested for a message in a queue, pass PROPID_M_ACKNOWLEDGE to MQReceiveMessage and examine its returned value. When passing PROPID_M_ACKNOWLEDGE to MQReceiveMessage, the corresponding VT field in the aPropVar array can be set to VT_NULL.
For information on the time-to-reach-queue and time-to-be-received timers, see Message Timers. To set the time-to-reach-queue and time-to-be-received timers, set PROPID_M_TIME_TO_REACH_QUEUE and PROPID_M_TIME_TO_BE_RECEIVED, respectively.
To see how PROPID_M_ACKNOWLEDGE is used when sending messages, see Sending Messages that Request Acknowledgments.
The following example sets PROPID_M_ACKNOWLEDGE and PROPID_M_ADMIN_QUEUE as part of preparing MQMSGPROPS.
MQMSGPROPS MsgProps;
PROPVARIANT aVariant[10];
MSGPROPID aPropId[10];
DWORD PropIdCount = 0;
HRESULT hr;
QUEUEHANDLE hQueue;
//
// Set PROPID_M_ACKNOWLEDGE.
//
aPropId[PropIdCount] = PROPID_M_ACKNOWLEDGE; //PropId
aVariant[PropIdCount].vt = VT_UI1; //Type
aVariant[PropIdCount].bVal = MQMSG_ACKNOWLEDGMENT_FULL_RECEIVE; //Value
PropIdCount++;
//
// Set the PROPID_M_ADMIN_QUEUE property.
//
aPropId[PropIdCount] = PROPID_M_ADMIN_QUEUE; //PropId
aVariant[PropIdCount].vt = VT_LPWSTR; //Type
aVariant[PropIdCount].pwszVal = szwAdminFormatName; //An already obtained format name of the admin queue.
PropIdCount++;
//
// Set other message properties such as PROPID_M_BODY, PROPID_M_LABEL.
//
//
// Set the MQMSGPROPS structure
//
MsgProps.cProp = PropIdCount; //Number of properties.
MsgProps.aPropID = aPropId; //Ids of properties.
MsgProps.aPropVar = aVariant; //Values of properties.
MsgProps.aStatus = NULL; //No Error report.
//
// Send message.
//
hr = MQSendMessage(
hQueue, // handle to the Queue.
&MsgProps, // Message properties to be sent.
MQ_NO_TRANSACTION // No transaction
);
if (FAILED(hr))
{
//
// Handle error condition
//
}
Windows NT: Requires version 4.0 SP3 or later.
Windows: Requires Windows 95 or later.
Windows CE: Unsupported.
Header: Declared in mq.h.
Import Library: Use mqrt.lib.
Unicode: Defined only as Unicode.
PROPID_M_ADMIN_QUEUE, PROPID_M_CLASS, PROPID_M_MSGID, PROPID_M_TIME_TO_BE_RECEIVED, PROPID_M_TIME_TO_REACH_QUEUE