summaryrefslogtreecommitdiff
path: root/cpp/src/qpid/broker/ThresholdAlerts.cpp
diff options
context:
space:
mode:
authorGordon Sim <gsim@apache.org>2011-03-11 14:58:31 +0000
committerGordon Sim <gsim@apache.org>2011-03-11 14:58:31 +0000
commit9c1e7ee11aa930ee73b92bb570865dbed5963315 (patch)
tree0102eb955387a2099a7512cc8866c754d9007edf /cpp/src/qpid/broker/ThresholdAlerts.cpp
parent2f0634a0b0461ec14f3faa56c4ff82c6f5a78dfb (diff)
downloadqpid-python-9c1e7ee11aa930ee73b92bb570865dbed5963315.tar.gz
QPID-3136: Add option to disable defaults for queue threshold alerts
git-svn-id: https://svn.apache.org/repos/asf/qpid/trunk/qpid@1080589 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'cpp/src/qpid/broker/ThresholdAlerts.cpp')
-rw-r--r--cpp/src/qpid/broker/ThresholdAlerts.cpp14
1 files changed, 7 insertions, 7 deletions
diff --git a/cpp/src/qpid/broker/ThresholdAlerts.cpp b/cpp/src/qpid/broker/ThresholdAlerts.cpp
index decb98df39..d616abadd6 100644
--- a/cpp/src/qpid/broker/ThresholdAlerts.cpp
+++ b/cpp/src/qpid/broker/ThresholdAlerts.cpp
@@ -126,12 +126,12 @@ void ThresholdAlerts::observe(Queue& queue, qpid::management::ManagementAgent& a
}
void ThresholdAlerts::observe(Queue& queue, qpid::management::ManagementAgent& agent,
- const qpid::framing::FieldTable& settings)
+ const qpid::framing::FieldTable& settings, uint16_t limitRatio)
{
qpid::types::Variant::Map map;
qpid::amqp_0_10::translate(settings, map);
- observe(queue, agent, map);
+ observe(queue, agent, map, limitRatio);
}
template <class T>
@@ -169,19 +169,19 @@ class Option
};
void ThresholdAlerts::observe(Queue& queue, qpid::management::ManagementAgent& agent,
- const qpid::types::Variant::Map& settings)
+ const qpid::types::Variant::Map& settings, uint16_t limitRatio)
{
//Note: aliases are keys defined by java broker
Option<int64_t> repeatInterval("qpid.alert_repeat_gap", 60);
repeatInterval.addAlias("x-qpid-minimum-alert-repeat-gap");
- //If no explicit threshold settings were given use 80% of any
- //limit from the policy.
+ //If no explicit threshold settings were given use specified
+ //percentage of any limit from the policy.
const QueuePolicy* policy = queue.getPolicy();
- Option<uint32_t> countThreshold("qpid.alert_count", (uint32_t) (policy ? policy->getMaxCount()*0.8 : 0));
+ Option<uint32_t> countThreshold("qpid.alert_count", (uint32_t) (policy && limitRatio ? (policy->getMaxCount()*limitRatio/100) : 0));
countThreshold.addAlias("x-qpid-maximum-message-count");
- Option<uint64_t> sizeThreshold("qpid.alert_size", (uint64_t) (policy ? policy->getMaxSize()*0.8 : 0));
+ Option<uint64_t> sizeThreshold("qpid.alert_size", (uint64_t) (policy && limitRatio ? (policy->getMaxSize()*limitRatio/100) : 0));
sizeThreshold.addAlias("x-qpid-maximum-message-size");
observe(queue, agent, countThreshold.get(settings), sizeThreshold.get(settings), repeatInterval.get(settings));