Report abuse

in env.rb

Thread.new {
  until EM.reactor_running?
    sleep 1
  end
  AMQP.start :host => 'localhost', :user => 'mapper', :pass => 'testing',
               :vhost => '/nanite'
  Nanite.identity = "mapper"
  Nanite.mapper = Nanite::Mapper.new(15)
end

or  rewrite a method that gets called upon startup

before_filter :start_nanite

def start_nanite
  def start_nanite
    AMQP.start :host => 'localhost', :user => 'mapper', :pass => 'testing',
               :vhost => '/nanite'
    Nanite.identity = "mapper"
    Nanite.mapper = Nanite::Mapper.new(15)
    true
  end
  true
end  

This will overwrite the method with a noop method after it gets hit the first time.

These are both hacks until I can get a proper callback in thin to spawn AMQP after the event loop is running.