PROPID_Q_BASEPRIORITY

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

Property ID

PROPID_Q_BASEPRIORITY

Type Indicator

VT_I2

MQPROPVARIANT Field

iVal

Property Value

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

Remarks

The base priority of a public queue is used for routing its 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. For example, when the base priority of a queue is set, all the messages sent to the queue are given a higher priority than messages sent to queues with a lower base priority. The base priority of the queue has no effect on the order of the messages in the queue or how messages are read from the queue.

PROPID_Q_BASEPRIORITY applies only 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 base priority of the queue with the priority of the message (PROPID_M_PRIORITY) to determine the overall priority of a message when it is sent to the queue.

To set the initial base priority of a public queue, specify PROPID_Q_BASEPRIORITY in the MQQUEUEPROPS structure and call MQCreateQueue.

To change the base priority of a public queue, specify PROPID_Q_BASEPRIORITY in the MQQUEUEPROPS structure and call MQSetQueueProperties.

To retrieve the base priority of a queue, specify PROPID_Q_BASEPRIORITY in the MQUEUEPROPS structure and call MQGetQueueProperties and examine its returned value.

When retrieving the priority level, the type indicator can be set to VT_I2 or VT_NULL. If you set the type indicator equal to VT_NULL, Message Queuing automatically changes the type indicator to VT_I2 during the function call.

Equivalent COM Property

When using COM components, the priority level of the queue can be set and retrieved using the MSMQQueueInfo.BasePriority property.

Example Code

The following code fragments show how PROPID_Q_BASEPRIORITY is specified in arrays that can be used to initialize an MQQUEUEPROPS structure for setting and retrieving the priority level of a queue.

To Set the Priority Level

aQueuePropID[I] = PROPID_Q_BASEPRIORITY;    // Property identifier
aQueuePropVar[I].vt = VT_I2;                // Type indicator
aQueuePropVar[I].iVal = 1000;               // Priority level of queue
i++;

To Retrieve the Priority Level

aQueuePropID[I] = PROPID_Q_BASEPRIORITY;   // Property identifier
aQueuePropVar[I].vt = VT_NULL;             // Type indicator
i++;

The following examples are included in Using Message Queuing.

For an example of See

Creating a public or private queue

C/C++ Code Example: Creating a Queue

Setting and retrieving the priority level of an existing queue

C/C++ Code Example: Setting PROPID_Q_BASEPRIORITY

C/C++ Code Example: Retrieving PROPID_Q_BASEPRIORITY

See Also

Show:
© 2014 Microsoft