Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Readme/examples should demonstrate AMQP connection with username/password #9

Open
gregkrsak opened this issue Mar 10, 2014 · 3 comments

Comments

@gregkrsak
Copy link

Currently, the README.md and examples only show an AMQP connection that appears to be using the default guest account. Could we get more info on how rjr operates with respect to opening connections that require credentials? If I re-create the guest account, my connection works just fine.

@gregkrsak
Copy link
Author

irb(main):003:0> puts amqp_node.invoke('gmk-dev-queue', 'hello', 'world')

Critical exception AMQP broker closed TCP connection before authentication succeeded: 
this usually means authentication failure due to misconfiguration. Settings are 
{:host=>"192.168.2.7", :port=>5672, :user=>"guest", :pass=>"[filtered]", 
:auth_mechanism=>"PLAIN", :vhost=>"/", :timeout=>nil, :logging=>false, :ssl=>false,
:frame_max=>131072, :heartbeat=>0}
/Library/Ruby/Gems/2.0.0/gems/amqp-1.3.0/lib/amqp/session.rb:187:in `block in initialize'
/Library/Ruby/Gems/2.0.0/gems/amqp-1.3.0/lib/amqp/session.rb:646:in `call'
/Library/Ruby/Gems/2.0.0/gems/amqp-1.3.0/lib/amqp/session.rb:646:in `unbind'
/Library/Ruby/Gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:1438:in `event_callback'
/Library/Ruby/Gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run_machine'
/Library/Ruby/Gems/2.0.0/gems/eventmachine-1.0.3/lib/eventmachine.rb:187:in `run'
/Library/Ruby/Gems/2.0.0/gems/rjr-0.18.2/lib/rjr/em_adapter.rb:34:in `block (2 levels) in start'

@movitto
Copy link
Owner

movitto commented Mar 11, 2014

@gregkrsak hey thanks for reaching out.

Admittedly I restrict access to my broker to localhost only so auth at that level isn't as pressing of a concern but it should be able to be easily incorporated.

The current RJR::Nodes::AMQP initialization will need to be expanded though to accept the username and password to use when connecting to the broker:

https://github.com/movitto/rjr/blob/master/lib/rjr/nodes/amqp.rb#L117

Upon initialization we can pass these credentials onto the ruby-amqp gem which rjr is using on the backend:

https://github.com/movitto/rjr/blob/master/lib/rjr/nodes/amqp.rb#L65
http://rubyamqp.info/articles/connecting_to_broker/

@movitto
Copy link
Owner

movitto commented Mar 11, 2014

Hey not 100% sure when I'll be able to get to this (have a bunch of high priority items on various backlogs for the next month or two) but created the issue to track it. Of course if you want to see this in sooner feel free to send a PR! :-)

Again thanks for the issue,
-Mo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants