Details
-
Bug
-
Status: Closed
-
Minor
-
Resolution: Fixed
-
0.20
-
None
Description
The 'connection-options' option is incorrectly handled as a string in the example clients, should be handled as a list.
- ruby spout.rb --connection-options "
{reconnect:True}
" "q;
{create:always}"
{reconnect:True}
2013-05-10 04:49:01 [Client] warning Exception received from broker:
not-found: not-found: Queue not found:(/builddir/build/BUILD/qpid-0.22/cpp/src/qpid/broker/SessionAdapter.cpp:693)
{reconnect:True}
[caused by 2 \x08:\x01]
./../lib/qpid_messaging/session.rb:63:in `createSender': Queuedoes not exist (MessagingError)
from ./../lib/qpid_messaging/session.rb:63:in `create_sender'
from spout.rb:106
2013-05-10 04:49:01 [Client] warning Connection
[127.0.0.1:56869-127.0.0.1:5672] closed
The 'nil' in the option parser looked weird to me, so I did the
following change to make the option work:
- vim spout.rb
- opts.on(nil, "--connection-options VALUE",
+ opts.on("--connection-options VALUE",
Following change results in another error, the connection's
convert_options method expects list not a string:
- ruby spout.rb --connection-options "
{reconnect:True}
" "q;
{create:always}"
{reconnect:True}
./../lib/qpid_messaging/connection.rb:149:in `convert_options':
undefined method `each_pair' for "":String
(NoMethodError)
from ./../lib/qpid_messaging/connection.rb:67:in `initialize'
from spout.rb:103:in `new'
from spout.rb:103
I used the following code to fix the issue, which was sufficient for
my needs (there would be probably a better solution, I guess):
- options[:connection_options] = conopts
+ options[:connection_options] = {}
+ conopts = conopts.gsub /^{(.*)}$/, '\1'
+ conopts.split(",").each do |x|
+ key,val = x.split(':')
+ options[:connection_options][key]= val
Packages used:
ruby gem: qpid_messaging-0.20.2
also valid for examples on trunk