def run
      bind_queues and return if test_env?
      start_shutdown_thread
      start_error_counter_thread
      client.on_exception do |e|
        count_error(e)
      end
      client.connect
      start_event_thread

      puts 'EventListener started. Hit Ctrl-C to exit'
      Thread.stop
      puts 'Main thread wakeup - exiting.'
      client.close
    end
def run
      bind_queues and return if test_env?
      start_shutdown_thread
      start_error_counter_thread
      client.on_exception do |e|
        count_error(e)
      end
      client.connect
      start_event_thread

      puts 'EventListener started. Hit Ctrl-C to exit'
      Thread.stop
      puts 'Main thread wakeup - exiting.'
      client.close
    end
Initialize a new EventListener daemon instance
 @param [Hash] options daemon options
 @option options [Integer] :error_limit (10) maximum number of errors that are allowed to occur within error_interval
   before the process terminates
 @option options [Integer] :error_interval (3600) time interval, in seconds, before the error counter is cleared
 @option options [String] :events_exchange ('events') name of AMQP exchange used for listening to event messages
 @option options [String] :models_exchange ('models') name of AMQP exchange used for listening to EventObserver
   instance create, update, and destroy messages
 @option options [String] :name ("#{Rails.application.class.parent_name.downcase}-listener") daemon instance name.
 Run the daemon process. This creates the event, error counter, and shutdown threads