Partager via


PROPID_Q_QUOTA

 

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 PROPID_Q_QUOTA property specifies the maximum storage size (in kilobytes) of the queue.

Property ID

PROPID_Q_QUOTA

Type Indicator

VT_UI4

MQPROPVARIANT Field

ulVal

Property Value

Maximum storage size (in kilobytes) of the queue. The default is INFINITE.

Remarks

When the PROPID_Q_QUOTA property is not set, the storage size of a queue is limited only by the available disk space on the local computer or the computer quota. For Windows® XP Professional, there is no default computer quota. For the Windows Server 2003 family, the default computer quota is 8 GB. For Windows 2000, the default computer quota is 2 GB. For more information on the computer quota and instructions on setting it, see the Message Queuing online Help.

The PROPID_Q_QUOTA property is typically set when calling MQCreateQueue. To set the maximum storage size, or quota, when creating the queue, specify PROPID_Q_QUOTA in the MQQUEUEPROPS structure and call MQCreateQueue.

When negative acknowledgment messages are requested and the quota of the destination queue is reached, a negative acknowledgment message is returned to the administration queue specified by the sending application to indicate that the queue is full. Message Queuing continues to send negative acknowledgments until the cumulative size of messages in the queue drops below the quota.

To change the maximum storage size of a queue, specify PROPID_Q_QUOTA in the MQQUEUEPROPS structure and call MQSetQueueProperties with the new value. When the quota of the queue is changed, the new quota affects only arriving messages; it does not affect messages already in the queue.

To retrieve the maximum storage size of a queue, specify PROPID_Q_QUOTA in the MQQUEUEPROPS structure and call MQGetQueueProperties and examine its returned value.

When retrieving the maximum storage size of a queue, the type indicator can be set to VT_UI4 or VT_NULL. If you set the type indicator equal to VT_NULL, Message Queuing automatically changes the type indicator to VT_UI4 during the function call.

Equivalent COM Property

When using COM components, the maximum storage size of the queue can be set and retrieved using the MSMQQueueInfo.Quota property.

Example Code

The following code fragments show how PROPID_Q_QU0TA is specified in arrays that can be used to initialize an MQQUEUEPROPS structure for setting and retrieving the maximum storage size of the queue.

To Set the Maximum Storage Size of the Queue

aQueuePropID[i] = PROPID_Q_QUOTA;          // Property identifier  
aQueuePropVar[i].vt = VT_UI4;              // Type indicator  
aQueuePropVar[i].bVal = 1000;              // Maximum size of the queue  
i++;  

To Retrieve the Maximum Storage Size of the Queue

aQueuePropID[i] = PROPID_Q_QUOTA;          // 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 queue C/C++ Code Example: Creating a Queue

 C/C++ Code Example: Creating a Transactional Queue
Setting and retrieving the maximum size of an existing queue C/C++ Code Example: Setting PROPID_Q_QUOTA

 C/C++ Code Example: Retrieving PROPID_Q_QUOTA

See Also

Queue Properties
MQCreateQueue
MQGetQueueProperties
MQQUEUEPROPS
MQSetQueueProperties