# maxmsgs

Topics and queues can specify the `maxmsgs` property in the form:

       maxmsgs=value

where value defines the maximum number of messages that can be waiting in a queue. When adding a message would exceed this limit, the server does not accept the message into storage, and the message producer’s send call returns an error (but see also `overflowPolicy`).

If `maxmsgs` is zero, or is not set, the server does not limit the number of messages in the queue.

Warning: If the `maxmsgs` limit is not set on a destination, the server still checks to see if that destination’s memory footprint is growing beyond a threshold. If so, a warning is logged. For more details, see `large_destination_memory` and `large_destination_count`.

You can set both `maxmsgs` and `maxbytes` properties on the same queue. Exceeding either limit causes the server to reject new messages until consumers reduce the queue size to below these limits.

Warning: Under certain conditions, because of the pipelined nature of message processing or the requirements of transactional messaging, the `maxmsgs` limit can be slightly exceeded. You may see message totals that are marginally larger than the set limit.
Note: You can further protect against consumers that receive messages without acknowledging them using the parameter `disconnect_non_acking_consumers`.
Copyright © Cloud Software Group, Inc. All rights reserved.