Module: Nanite::AMQPHelper

Included in:
Agent, Mapper, MapperProxy
Defined in:
lib/nanite/amqp.rb

Instance Method Summary collapse

Instance Method Details

#start_amqp(options) ⇒ Object



54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
# File 'lib/nanite/amqp.rb', line 54

def start_amqp(options)
  connection = AMQP.connect({
    :user => options[:user],
    :pass => options[:pass],
    :vhost => options[:vhost],
    :host => options[:host],
    :port => (options[:port] || ::AMQP::PORT).to_i,
    :insist => options[:insist] || false,
    :retry => options[:retry] || 5,
    :connection_status => options[:connection_callback] || proc {|event| 
      Nanite::Log.debug("Connected to MQ") if event == :connected
      Nanite::Log.debug("Disconnected from MQ") if event == :disconnected
    }
  })
  MQ.new(connection)
end