Gets or sets the maximum size of the queue.
[Visual Basic] Overridable Public Property MaximumQueueSize As Long [C#] public long MaximumQueueSize {virtual get; virtual set;} [C++] public: __property virtual __int64 get_MaximumQueueSize(); public: __property virtual void set_MaximumQueueSize(__int64); [JScript] public function get MaximumQueueSize() : long; public function set MaximumQueueSize(long);
The maximum size in kilobytes of the queue. The Message Queuing default is no limit.
Exception Type | Condition |
---|---|
ArgumentException | The maximum queue size was set to a negative value. |
MessageQueueException | The attempt to get or set the maximum queue size generated an internal error on the message queue component. The error is specified by the given status message. |
MaximumQueueSize provides access to the Message Queuing message storage limit. This is separate from the Administrator-defined computer quota.
If a queue exceeds the maximum size set for the queue or the Administrator-defined computer quota, messages may be lost. When the quota of a queue is reached, Message Queuing returns a negative acknowledgment message to the administration queue of 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
The following example demonstrates creating a new Message Queuing backend queue object and setting the MaximumJournalSize and MaximumQueueSize for the queue. A message is then sent to the queue to test the connection. This example assumes you have a Message Queuing server called myComputer and a queue called myNewQueue does not exist yet on the computer.
[Visual Basic]
Private Sub CreateNewQueue() 'Define a MessageQueue. Dim mq As MessageQueue 'Set the MessageQueue to point to a new queue. mq = MessageQueue.Create("myComputer\myNewQueue") 'Use the journal queue for all received messages. mq.UseJournalQueue = True 'Set the size in kilobytes of the journal queue. mq.MaximumJournalSize = 5 'Set the size in kilobytes of the queue. mq.MaximumQueueSize = 10 'Send a message to the new queue. mq.Send("Test") End Sub
MessageQueue Class | MessageQueue Members | System.Messaging Namespace | MaximumJournalSize