1 May 2011 15:28
[PATCH/mcollective 1/1] 7246 - add the ability to add the priority to JMS messages
R.I.Pienaar <rip <at> devco.net>
2011-05-01 13:28:22 GMT
2011-05-01 13:28:22 GMT
Add a plugin.stomp.priority option that will be used by recent
versions of ActiveMQ to prioritize our messages over others.
Signed-off-by: R.I.Pienaar <rip <at> devco.net>
---
Local-branch: feature/master/7246_stomp_priority
plugins/mcollective/connector/stomp.rb | 19 +++++++++++++++++--
website/changelog.md | 1 +
website/reference/plugins/connector_stomp.md | 9 +++++++++
3 files changed, 27 insertions(+), 2 deletions(-)
diff --git a/plugins/mcollective/connector/stomp.rb b/plugins/mcollective/connector/stomp.rb
index 17ef337..2806ed4 100644
--- a/plugins/mcollective/connector/stomp.rb
+++ b/plugins/mcollective/connector/stomp.rb
<at> <at> -51,6 +51,13 <at> <at> module MCollective
# plugin.stomp.pool.max_reconnect_attempts = 0
# plugin.stomp.pool.randomize = false
# plugin.stomp.pool.timeout = -1
+ #
+ # For versions of ActiveMQ that supports message priorities
+ # you can set a priority, this will cause a "priority" header
+ # to be emitted if present:
+ #
+ # plugin.stomp.priority = 4
+ #
class Stomp<Base
attr_reader :connection
<at> <at> -72,6 +79,7 <at> <at> module MCollective
user = nil
password = nil
<at> base64 = get_bool_option("stomp.base64", false)
+ <at> msgpriority = get_option("stomp.priority", 0).to_i
# Maintain backward compat for older stomps
unless <at> config.pluginconf.include?("stomp.pool.size")
<at> <at> -144,9 +152,9 <at> <at> module MCollective
# deal with deprecation warnings in newer stomp gems
if <at> connection.respond_to?("publish")
- <at> connection.publish(target, msg)
+ <at> connection.publish(target, msg, msgheaders)
else
- <at> connection.send(target, msg)
+ <at> connection.send(target, msg, msgheaders)
end
end
<at> <at> -173,6 +181,13 <at> <at> module MCollective
end
private
+ def msgheaders
+ headers = {}
+ headers = {"priority" => <at> msgpriority} if <at> msgpriority > 0
+
+ return headers
+ end
+
# looks in the environment first then in the config file
# for a specific option, accepts an optional default.
#
diff --git a/website/changelog.md b/website/changelog.md
index 2b09f71..9b4dff8 100644
--- a/website/changelog.md
+++ b/website/changelog.md
<at> <at> -11,6 +11,7 <at> <at> title: Changelog
|Date|Description|Ticket|
|----|-----------|------|
+|2011/05/01|Support setting a priority on Stomp messages|7246|
|2011/04/30|Handle broken and incomplete DDLs better and improve the format of DDL output|7191|
|2011/04/23|Encode the target agent and collective in requests|7223|
|2011/04/20|Make the SSL Cipher used a config option|7191|
diff --git a/website/reference/plugins/connector_stomp.md b/website/reference/plugins/connector_stomp.md
index 752cd7d..96bec76 100644
--- a/website/reference/plugins/connector_stomp.md
+++ b/website/reference/plugins/connector_stomp.md
<at> <at> -62,3 +62,12 <at> <at> plugin.stomp.pool.max_reconnect_attempts = 0
plugin.stomp.pool.randomize = false
plugin.stomp.pool.timeout = -1
{% endhighlight %}
+
+### Message Priority
+
+As of version 5.4 of ActiveMQ messages support priorities, you can pass in the needed
+priority header by setting:
+
+{% highlight ini %}
+plugin.stomp.priority = 4
+{% endhighlight %}
--
1.7.1
--
--
You received this message because you are subscribed to the Google Groups "Puppet Developers" group.
To post to this group, send email to puppet-dev <at> googlegroups.com.
To unsubscribe from this group, send email to puppet-dev+unsubscribe <at> googlegroups.com.
For more options, visit this group at http://groups.google.com/group/puppet-dev?hl=en.
RSS Feed