qpid-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF subversion and git services (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (QPID-4834) Ruby client examples incorrectly handles '--connection-options' option
Date Fri, 12 Jul 2013 19:15:48 GMT

    [ https://issues.apache.org/jira/browse/QPID-4834?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=13707271#comment-13707271
] 

ASF subversion and git services commented on QPID-4834:
-------------------------------------------------------

Commit 1502660 from [~mcpierce]
[ https://svn.apache.org/r1502660 ]

QPID-4834: Fixed how Ruby spout example processes connection options

The argument comes in as a string. It is now processed, the keys and
values extracted and put into a proper Hash that is then passed to the
Qpid::Messaging::Connection object.
                
> 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
>
> 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-unsubscribe@qpid.apache.org
For additional commands, e-mail: dev-help@qpid.apache.org


Mime
View raw message