BasePriority
MSMQQueueInfo

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

Type: Long
Run time: read/write

Syntax

object.BasePriority
 
Syntax Element Description
object Queue information (MSMQQueueInfo) object that defines the queue.

Settings

Integer value between -32768 and +32767 (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 Active Directory (using a public format name). The base priority of private queues, as well as public queues accessed directly, is always 0.

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

To set the base priority of a public queue, set BasePriority and call the MSMQQueueInfo object's Create method.

To reset the base priority of a public queue after the queue is created, set BasePriority to a new level and, if the queue is open, call the MSMQQueueInfo object's Update method. If the queue is not open, do not call Update because the queue's properties are updated automatically when the queue is opened.

The base priority of a queue can be reset after the queue is created. To change the base priority of a queue that is open, set BasePriority to a new level and call the MSMQQueueInfo object's Update method. To change the base priority of a closed queue, set Basepriority to the new level. If the queue is not open, there is no need to call Update because the queue's properties are updated automatically when the queue is opened.

To find the base priority of a queue, call the MSMQQueueInfo object's Refresh method.

Example

This example creates a public queue on the local computer, setting the queue's base priority to 7.

To try this example using Microsoft® Visual Basic® (version 5.0), make sure the Microsoft Message Queue Object Library is referenced, paste the following code into the Code window of a form, run the example, and click the form.

Dim qinfo As MSMQQueueInfo
   
Private Sub Form_Click()
    
  Set qinfo = New MSMQQueueInfo
  qinfo.PathName = ".\basepriorityTest"
  qinfo.Label = "Test Queue"
  qinfo.BasePriority = 7
  qinfo.Create
   
  MsgBox "Queue's Format name is: " + qinfo.FormatName

End Sub
 

QuickInfo

  Windows NT: Requires version 4.0 SP3 or later.
  Windows: Requires Windows 95 or later.
  Windows CE: Unsupported.
  Header: Declared in mqoai.h.
  Import Library: Use mqoa.lib.
  Unicode: Defined only as Unicode.

See Also

Create, FormatName, Label, MSMQQueueInfo, PathName, Priority, Refresh, Update