简体   繁体   English

如何在Ruby AMQP Carrot Library中使用外部服务器

[英]How to use an external server with Ruby AMQP Carrot Library

I am using the Ruby AMQP Carrot library and I am trying to talk to a test RabbitMQ server on a virtual machine. 我正在使用Ruby AMQP Carrot库,并且试图与虚拟机上的测试RabbitMQ服务器通信。 The AMQP port is open on the machine but I can't get Carrot to establish an external connection. 机器上的AMQP端口已打开,但是我无法让Carrot建立外部连接。 I have tried the following: 我尝试了以下方法:

Carrot.queue('message', :durable => true, :server => '192.168.162.176') Carrot.queue('消息',:durable => true,:server =>'192.168.162.176')

Carrot.queue('message', :durable => true, :host => '192.168.162.176') Carrot.queue('消息',:durable => true,:host =>'192.168.162.176')

I talked with the Carrot developer and this is the answer he gave me and it works great: 我与Carrot开发人员进行了交谈,这是他给我的答案,效果很好:

@client = Carrot.new(
 :host   => host,
 :port   => port.to_i,
 :user   => @opts['user'],
 :pass   => @opts['pass'],
 :vhost  => @opts['vhost'],
 :insist => @opts['insist']
)

queue = @client.queue('foo')

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM