Partilhar via


MSMQQueueInfo.BasePriority

 

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

Optional. The BasePriority property of the MSMQQueueInfo object specifies a single base priority for all messages sent to a public queue.

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

Property Value

Integer value between -32768 and +32767 (the default is 0).

Remarks

A public queue's base priority is used for routing the queue's messages over the network. It can be used to give the messages sent to the queue a higher (or lower) priority than messages sent to other queues. When a queue's base priority is set, all the messages sent to it are given a higher priority than messages sent to queues with a lower base priority. The queue's base priority has no effect on the order of the messages in the queue or how messages are read from the queue.

BasePriority only applies to public queues that can be located through the directory service (using a public format name). The base priority of private queues, as well as public queues accessed directly, is always 0.

Message Queuing combines the queue's base priority with the message's priority (MSMQMessage.Priority) to determine the overall priority of a message when it is sent to the queue.

To specify the priority level when creating a public queue, set the MSMQQueueInfo.PathName property and the BasePriority property, and then call the MSMQQueueInfo.Create method.

To reset or retrieve the priority level of an existing queue, your application must first obtain an MSMQQueueInfo object that represents the queue. This object can be returned by a query using the MSMQQuery.LookupQueue method or created by the sending or receiving application.

Before using an application-created MSMQQueueInfo object, the application must initialize it to reference the queue by setting its MSMQQueueInfo.PathName or MSMQQueueInfo.FormatName property. Setting the FormatName property with a cached public format name instead of the PathName property frees Message Queuing from the need to retrieve information stored in the directory service to generate this format name.

To reset the priority level of an existing public queue, set BasePriority to a new level and call the MSMQQueueInfo.Update method. This method updates the queue information stored by Message Queuing. For public queues, this information is stored in the directory service.

To retrieve the stored priority level of a queue, call the MSMQQueueInfo.Refresh method and inspect the MSMQQueueInfo.BasePriority property. The property values of the MSMQQueueInfo object are not updated with the values stored by Message Queuing until the MSMQQueueInfo.Refresh method is called.

Equivalent API FunctionProperty

With function calls, the equivalent property is PROPID_Q_BASEPRIORITY.

Example Code

The following examples are included in Using Message Queuing.

For an example of See
Creating queues Creating Queue Examples
Setting and retrieving the priority level of an existing queue Visual Basic Code Example: Setting MSMQQueueInfo.BasePriority

 Visual Basic Code Example: Retrieving MSMQQueueInfo.BasePriority

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.Priority
MSMQQueueInfo
MSMQQueueInfo.Create
MSMQQueueInfo.Refresh
MSMQQueueInfo.Update
PROPID_Q_BASEPRIORITY