次の方法で共有


PROPID_M_ACKNOWLEDGE (Compact 2013)

3/26/2014

This property specifies the type of acknowledgment messages the system posts (in the administration queue) and when acknowledgments are returned.

  • Type Indicator
    VT_UI1 (or VT_NULL)
  • PROPVARIANT Field
    bVal
  • Property Values
    This property can be set to one or more of the following values using the OR operator.

    Value

    Description

    MQMSG_ACKNOWLEDGMENT_FULL_REACH_QUEUE

    Posts a positive or negative acknowledgment depending on whether the message reaches the queue.

    A negative acknowledgment is posted when the time-to-reach-queue timer of the message expires or when the message cannot be authenticated.

    MQMSG_ACKNOWLEDGMENT_NACK_REACH_QUEUE

    Posts a negative acknowledgment when the message cannot reach the queue.

    A negative acknowledgment is posted when the time-to-reach-queue timer of the message expires or when the message cannot be authenticated.

    MQMSG_ACKNOWLEDGMENT_FULL_RECEIVE

    Posts a positive or negative acknowledgment depending on whether the message is retrieved from the queue before its time-to-be-received timer expires.

    MQMSG_ACKNOWLEDGMENT_NACK_RECEIVE

    Posts a negative acknowledgment when an error occurs and the message cannot be retrieved from the queue before its time-to-be-received timer expires.

    MQMSG_ACKNOWLEDGMENT_NONE

    The default. No acknowledgment messages (positive or negative) are posted.

Remarks

When asking for acknowledgments, you must also specify the administration queue where the acknowledgment messages will be sent.

To request acknowledgment messages, specify PROPID_M_ACKNOWLEDGE and PROPID_M_ADMIN_QUEUE in the MQMSGPROPS structure and call MQSendMessage.

To find out if an acknowledgment message was requested for a message in a queue, specify PROPID_M_ACKNOWLEDGEin the MQMSGPROPS structure. Then, call MQReceiveMessage and examine its returned value.

When specifying PROPID_M_ACKNOWLEDGE, you can set its Type Indicator to VT_NULL. When the Type Indicator is set to VT_NULL, MSMQ sets the VT field to the appropriate type indicator.

To receive a positive acknowledgment message when a message reaches its destination and when the message is retrieved, the following full-acknowledgment settings must be combined using the OR operator:

  • MQMSG_FULL_REACH_QUEUE
  • MQMSG_FULL_RECEIVE

Acknowledgment messages are typically MSMQ-generated messages; however, they can also be created by MSMQ connector applications when sending messages to a foreign queue.

Examples

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

aMsgPropId[i] = PROPID_M_ACKNOWLEDGE;   // Property ID
aMsgPropVar[i].vt = VT_UI1;             // Type indicator
aMsgPropVar[i].bVal = MQMSG_ACKNOWLEDGMENT_FULL_RECEIVE;
i++;

Note

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

Requirements

Header

mq.h

See Also

Reference

MSMQ Properties
MQReceiveMessage
MQSendMessage
PROPID_M_ADMIN_QUEUE
MQMSGPROPS