PROPID_M_PRIORITY

The PROPID_M_PRIORITY property specifies the message's priority. 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 automatically sets the priority level of transactional messages to 0: PROPID_M_PRIORITY is ignored by the transaction. For information on transactions, see MSMQ Transactions.

To set the priority of a message, pass PROPID_M_PRIORITY to MQSendMessage.

To determine the priority of a message in the queue, pass PROPID_M_PRIORITY to MQReceiveMessage and examine its returned value. When passing PROPID_M_PRIORITY to MQReceiveMessage, the corresponding VT field in the aPropVar array can be set to VT_NULL.

If the message is sent to a public queue, a second priority (the queue's PROPID_Q_BASEPRIORITY property) is added to PROPID_M_PRIORITY for routing purposes. However, the queue's base priority has no effect on how messages are placed in the queue.

QuickInfo

  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.

See Also

MQReceiveMessage, PROPID_Q_BASEPRIORITY