共用方式為


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

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

Property Value

A long integer indicating the maximum storage size of the queue (default is INFINITE).

Remarks

When the 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.

Quota is typically set when the queue is created. However, the maximum size of an existing queue can be changed as well. 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 specify the quota when creating a queue, set the MSMQQueueInfo.PathName property and the Quota property, and then call the MSMQQueueInfo.Create method.

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.

To reset or retrieve the quota 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 refer to the queue by setting its MSMQQueueInfo.PathName or MSMQQueueInfo.FormatName property. For public queues, 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. Direct format names can be used only for local private queues.

To reset the quota of an existing queue, set Quota to a new level and call the MSMQQueueInfo.Update method. This method updates the queue information stored by Message Queuing.

To retrieve the quota of a queue, call the MSMQQueueInfo.Refresh method. For public queues, this information is retrieved from the directory service. For private queues, this information is retrieved from the local computer. 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 Function Property

With function calls, the equivalent property is PROPID_Q_QUOTA.

Example Code

The following example is included in Using Message Queuing.

For an example of See
Setting and retrieving the maximum size of an existing queue Visual Basic Code Example: Setting MSMQQueueInfo.Quota

 Visual Basic Code Example: Retrieving MSMQQueueInfo.Quota

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

MSMQQueueInfo
MSMQQueueInfo.Create
MSMQQueueInfo.Refresh
MSMQQueueInfo.Update
PROPID_Q_QUOTA