Questo contenuto non è disponibile nella lingua selezionata.
8.2. Queue Sizing
8.2.1. Controlling Queue Size Copia collegamentoCollegamento copiato negli appunti!
qpid.max_size) and maximum message count (qpid.max_count) for the queue.
qpid.max_size is specified in bytes. qpid.max_count is specified as the number of messages.
qpid-config creates a queue with a maximum size in memory of 200MB, and a maximum number of 5000 messages:
qpid-config add queue my-queue --max-queue-size=204800000 --max-queue-count 5000
qpid-config add queue my-queue --max-queue-size=204800000 --max-queue-count 5000
qpid.max_count and qpid.max_size directives go inside the arguments of the x-declare of the node. For example, the following address will create the queue as the qpid-config command above:
- Python
tx = ssn.sender("my-queue; {create: always, node: {x-declare: {'auto-delete': True, arguments:{'qpid.max_count': 5000, 'qpid.max_size': 204800000}}}}")tx = ssn.sender("my-queue; {create: always, node: {x-declare: {'auto-delete': True, arguments:{'qpid.max_count': 5000, 'qpid.max_size': 204800000}}}}")Copy to Clipboard Copied! Toggle word wrap Toggle overflow
qpid.max_count attribute will only be applied if the queue does not exist when this code is executed.
qpid.policy_type
The behavior when a queue reaches these limits is configurable. By default, on non-durable queues the behavior is reject: further attempts to send to the queue result in a TargetCapacityExceeded exception being thrown at the sender.
qpid.policy_type option. The possible values are:
- reject
- Message publishers throw an exception
TargetCapacityExceeded. This is the default behavior for non-durablequeues. - ring
- The oldest messages are removed to make room for newer messages.
qpid-config command sets the limit policy to ring:
qpid-config add queue my-queue --max-queue-size=204800 --max-queue-count 5000 --limit-policy ring
qpid-config add queue my-queue --max-queue-size=204800 --max-queue-count 5000 --limit-policy ring
- Python
tx = ssn.sender("my-queue; {create: always, node: {x-declare: {'auto-delete': True, arguments:{'qpid.max_count': 5000, 'qpid.max_size': 204800, 'qpid.policy_type': 'ring'}}}}")tx = ssn.sender("my-queue; {create: always, node: {x-declare: {'auto-delete': True, arguments:{'qpid.max_count': 5000, 'qpid.max_size': 204800, 'qpid.policy_type': 'ring'}}}}")Copy to Clipboard Copied! Toggle word wrap Toggle overflow
See Also: