我尝试使用正确的 amqp 凭据启动 amqp,但它失败了。我已经在端口 5678 上启动了 rabbitmq 服务器,我正在使用 0.7.0 版本的 amqp gem,我正在使用 ruby-1.9.2
这是我在 irb 中所做的日志
± irb
/Users/ckgagan/.rvm/rubies/ruby-1.9.2-p320/bin/irb:4: warning: Insecure world writable dir /usr/local/bin in PATH, mode 040777
1.9.2-p320 :001 > require 'mq'
=> true
1.9.2-p320 :002 > AMQP.start({"host"=>"localhost", "port"=>5678, "user"=>"username", "password"=>"password"}) do
1.9.2-p320 :003 > puts "hello"
1.9.2-p320 :004?> end
AMQP::Error: Could not connect to server 127.0.0.1:5672
from /Users/ckgagan/.rvm/gems/ruby-1.9.2-p320@my_gemset/gems/amqp-0.7.0/lib/amqp/client.rb:76:in `block in initialize'
from /Users/ckgagan/.rvm/gems/ruby-1.9.2-p320@my_gemset/gems/amqp-0.7.0/lib/amqp/client.rb:107:in `call'
from /Users/ckgagan/.rvm/gems/ruby-1.9.2-p320@my_gemset/gems/amqp-0.7.0/lib/amqp/client.rb:107:in `block in unbind'
from /Users/ckgagan/.rvm/gems/ruby-1.9.2-p320@my_gemset/gems/eventmachine-1.0.0/lib/eventmachine.rb:959:in `call'
from /Users/ckgagan/.rvm/gems/ruby-1.9.2-p320@my_gemset/gems/eventmachine-1.0.0/lib/eventmachine.rb:959:in `block in run_deferred_callbacks'
from /Users/ckgagan/.rvm/gems/ruby-1.9.2-p320@my_gemset/gems/eventmachine-1.0.0/lib/eventmachine.rb:956:in `times'
from /Users/ckgagan/.rvm/gems/ruby-1.9.2-p320@my_gemset/gems/eventmachine-1.0.0/lib/eventmachine.rb:956:in `run_deferred_callbacks'
from /Users/ckgagan/.rvm/gems/ruby-1.9.2-p320@my_gemset/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run_machine'
from /Users/ckgagan/.rvm/gems/ruby-1.9.2-p320@my_gemset/gems/eventmachine-1.0.0/lib/eventmachine.rb:187:in `run'
from /Users/ckgagan/.rvm/gems/ruby-1.9.2-p320@my_gemset/gems/amqp-0.7.0/lib/amqp.rb:81:in `start'
from (irb):2
from /Users/ckgagan/.rvm/rubies/ruby-1.9.2-p320/bin/irb:16:in `<main>'
即使我尝试在 5678 连接 Rabbitmq 服务器,它也尝试连接到默认端口
Could not connect to server 127.0.0.1:5672
为什么即使我指定了端口 5678 ,它仍试图连接到端口 5678?
我无法弄清楚这一点并卡在这里
谢谢