ruby-on-railsrubyamqpcarrot

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. The AMQP port is open on the machine but I can't get Carrot to establish an external connection. I have tried the following:

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

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


Solution

  • I talked with the Carrot developer and this is the answer he gave me and it works great:

    @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')