Author: chirino
Date: Wed Aug 1 16:02:20 2012
New Revision: 1368085
URL: http://svn.apache.org/viewvc?rev=1368085&view=rev
Log:
Implements APLO-232: Add support for enforcing a message count based quota on
queues.
Modified:
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueSettingsDTO.java
activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md
Modified:
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala?rev=1368085&r1=1368084&r2=1368085&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
(original)
+++
activemq/activemq-apollo/trunk/apollo-broker/src/main/scala/org/apache/activemq/apollo/broker/Queue.scala
Wed Aug 1 16:02:20 2012
@@ -138,7 +138,8 @@ class Queue(val router: LocalRouter, val
* The max memory to allow this queue to grow to.
*/
var tune_quota = -1L
-
+ var tune_quota_messages = -1L
+
/**
* The message delivery rate (in bytes/sec) at which
* the queue enables a enqueue rate throttle
@@ -234,6 +235,7 @@ class Queue(val router: LocalRouter, val
tune_catchup_enqueue_rate = mem_size(update.catchup_enqueue_rate,"-1")
tune_max_enqueue_rate = mem_size(update.max_enqueue_rate,"-1")
tune_quota = mem_size(update.quota,"-1")
+ tune_quota_messages = update.quota_messages.getOrElse(-1L)
full_policy = Option(update.full_policy).getOrElse("block").toLowerCase
match {
case "drop head" => DropHead
@@ -568,7 +570,7 @@ class Queue(val router: LocalRouter, val
var refiller: Task = null
- def is_quota_exceeded = (tune_quota >= 0 && queue_size > tune_quota)
+ def is_quota_exceeded = (tune_quota >= 0 && queue_size > tune_quota) ||
(tune_quota_messages >= 0 && queue_items > tune_quota_messages)
def is_enqueue_throttled = (enqueues_remaining!=null &&
enqueues_remaining.get() <= 0)
def is_enqueue_buffer_maxed = (producer_swapped_in.size >=
producer_swapped_in.size_max)
Modified:
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueSettingsDTO.java
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueSettingsDTO.java?rev=1368085&r1=1368084&r2=1368085&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueSettingsDTO.java
(original)
+++
activemq/activemq-apollo/trunk/apollo-dto/src/main/java/org/apache/activemq/apollo/dto/QueueSettingsDTO.java
Wed Aug 1 16:02:20 2012
@@ -71,6 +71,13 @@ public class QueueSettingsDTO {
public String quota;
/**
+ * The maximum number of messages queue is allowed
+ * to grow to. If not set then there is no limit.
+ */
+ @XmlAttribute(name="quota_messages")
+ public Long quota_messages;
+
+ /**
* Once the queue is full, the `full_policy` controls how the
* queue behaves when additional messages attempt to be enqueued
* onto the queue.
Modified:
activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md
URL:
http://svn.apache.org/viewvc/activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md?rev=1368085&r1=1368084&r2=1368085&view=diff
==============================================================================
---
activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md
(original)
+++
activemq/activemq-apollo/trunk/apollo-website/src/documentation/user-manual.md
Wed Aug 1 16:02:20 2012
@@ -361,6 +361,9 @@ memory. Defaults to true.
use settings values like: `500mb` or `1g` just plain byte count
like `1024000`. Once the quota is Exceeded, the producers will
block until the usage decreases. Defaults to no limit.
+
+* `quota_messages` : The maximum number of messages queue is allowed
+ to grow to. If not set then there is no limit. Defaults to no limit.
* `auto_delete_after`: If not set to `0` then the queue will automatically
delete once there have been no consumers, producers or messages on it