Delen via


MSMQMessage.Priority

 

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

The Priority property of the MSMQMessage object specifies the message's priority. A low number indicates a low priority message.

Data type: Long
Run-time access: Read/write
Property Priority As Long  

Property Value

Priority can be set to any integer value between 7 and 0 (the default is 3).

Remarks

Message priority affects how Message Queuing 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. For example, when routing messages Message Queuing handles messages with a priority of 7 before it handles messages with a priority of 0 and, when the message is delivered to the destination queue, places the priority 7 messages closer to the front of the queue.

Messages with the same priority are placed in the queue according to their arrival time.

When Message Queuing routes a message to a public queue, the priority level of the message is added to the priority level of the public queue (the priority level of the queue is specified by the MSMQQueueInfo.BasePriority property of the queue). However, the priority level of the queue has no effect on how messages are placed in the queue.

Message Queuing automatically sets the priority level of transactional messages to 0: Priority is ignored by the transaction. For information about transactions, see Transactions.

Equivalent API Function Property

With API function calls, the equivalent property is PROPID_M_PRIORITY.

Requirements

Windows NT/2000/XP: Included in Windows NT 4.0 SP3 and later.

Windows 95/98/Me: Included in Windows 95 and later.

Header: Declared in Mqoai.h.

Library: Use Mqoa.lib.

See Also

MSMQMessage
MSMQQueueInfo.BasePriority
PROPID_M_PRIORITY