[ https://issues.apache.org/jira/browse/QPID-4834?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel ]
Darryl L. Pierce resolved QPID-4834. ------------------------------------ Resolution: Fixed Fix Version/s: Future > Ruby client examples incorrectly handles '--connection-options' option > ---------------------------------------------------------------------- > > Key: QPID-4834 > URL: https://issues.apache.org/jira/browse/QPID-4834 > Project: Qpid > Issue Type: Bug > Components: Ruby Client > Affects Versions: 0.20 > Reporter: Petr Matousek > Assignee: Darryl L. Pierce > Priority: Minor > Fix For: Future > > > 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}" > 2013-05-10 04:49:01 [Client] warning Exception received from broker: > not-found: not-found: Queue not found: {reconnect:True} > (/builddir/build/BUILD/qpid-0.22/cpp/src/qpid/broker/SessionAdapter.cpp:693) > [caused by 2 \x08:\x01] > ./../lib/qpid_messaging/session.rb:63:in `createSender': Queue > {reconnect:True} does 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}" > ./../lib/qpid_messaging/connection.rb:149:in `convert_options': > undefined method `each_pair' for "{reconnect:True}":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 -- This message is automatically generated by JIRA. If you think it was sent incorrectly, please contact your JIRA administrators For more information on JIRA, see: http://www.atlassian.com/software/jira --------------------------------------------------------------------- To unsubscribe, e-mail: dev-unsubscr...@qpid.apache.org For additional commands, e-mail: dev-h...@qpid.apache.org