summaryrefslogtreecommitdiff
path: root/qpid/cpp
diff options
context:
space:
mode:
Diffstat (limited to 'qpid/cpp')
-rw-r--r--qpid/cpp/bindings/qpid/ruby/ChangeLog3
-rw-r--r--qpid/cpp/bindings/qpid/ruby/examples/spout.rb25
2 files changed, 26 insertions, 2 deletions
diff --git a/qpid/cpp/bindings/qpid/ruby/ChangeLog b/qpid/cpp/bindings/qpid/ruby/ChangeLog
index b964e33998..f9906c2d51 100644
--- a/qpid/cpp/bindings/qpid/ruby/ChangeLog
+++ b/qpid/cpp/bindings/qpid/ruby/ChangeLog
@@ -1,3 +1,6 @@
+Version 0.26:
+ * QPID-4834: Ruby client examples incorrectly handles '--connection-options' option
+
Version 0.24:
* No language-specific changes.
diff --git a/qpid/cpp/bindings/qpid/ruby/examples/spout.rb b/qpid/cpp/bindings/qpid/ruby/examples/spout.rb
index f7170f146b..ebcf08b7a5 100644
--- a/qpid/cpp/bindings/qpid/ruby/examples/spout.rb
+++ b/qpid/cpp/bindings/qpid/ruby/examples/spout.rb
@@ -85,8 +85,9 @@ opts = OptionParser.new do |opts|
options[:content] = content
end
- opts.on(nil, "--connection-options VALUE",
+ opts.on("--connection-options VALUE",
"connection options string in the form {name1:value1, name2:value2}") do |conopts|
+
options[:connection_options] = conopts
end
end
@@ -100,7 +101,27 @@ end
# now get the non-arg options
options[:address] = ARGV[0] unless ARGV[0].nil?
-connection = Qpid::Messaging::Connection.new :url => options[:broker], :options => options[:connection_options]
+# process the connection options
+unless options[:connection_options].nil?
+ fields = options[:connection_options].gsub(/^{(.*)}$/, '\1')
+ # remove any surrounding braces
+ if /{.*}/ =~ fields
+ fields = fields[1..-2]
+ end
+ # break up the options separated by commas
+ keysvalues = {}
+ fields.split(",").each do |field|
+ if /.+:.+/ =~ field
+ (key, value) = field.split(":")
+ keysvalues[key] = value
+ end
+ end
+ # now store the options
+ options[:connection_options] = keysvalues
+end
+
+connection = Qpid::Messaging::Connection.new(:url => options[:broker],
+ :options => options[:connection_options])
connection.open
session = connection.create_session
sender = session.create_sender options[:address]