次の方法で共有


PROPID_M_PRIORITY (Compact 2013)

3/26/2014

This property specifies the priority of the message. A low number means low priority.

  • Type Indicator
    VT_UI1 (or VT_NULL)
  • PROPVARIANT Field
    bVal
  • Property Values
    An integer value between 7 and 0. The default is 3.

Remarks

Message priority effects how MSMQ handles the message while it is in route, as well as where the message is placed in the queue.

Higher priority messages are given preference during routing and inserted toward the front of the queue. Messages with the same priority are placed in the queue according to their arrival time.

MSMQ sets the priority level of transactional messages to 0: PROPID_M_PRIORITY is ignored by the transaction.

To set the priority of a message, specify PROPID_M_PRIORITY in the MQMSGPROPS structure and call MQSendMessage.

To determine the priority of a message in the queue, specify PROPID_M_PRIORITY in the MQMSGPROPS structure. Then call MQReceiveMessage and examine its returned value.

When specifying PROPID_M_PRIORITY, 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.

Examples

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

MsgProps.aPropID[i] = PROPID_M_PRIORITY;          // Property ID
MsgProps.aPropVar[i].vt = VT_UI1;                 // Type indicator
MsgProps.aPropVar[i].bVal = 7;

Note

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

Requirements

Header

mq.h

See Also

Reference

MSMQ Properties
MQReceiveMessage
MQSendMessage
MQMSGPROPS