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



41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/nanite/amqp.rb', line 41

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