Class: HerdstWorker::Application
- Inherits:
-
Object
- Object
- HerdstWorker::Application
- Defined in:
- lib/herdst_worker/application/facade.rb
Instance Attribute Summary collapse
-
#autoload ⇒ Object
Returns the value of attribute autoload.
-
#config ⇒ Object
Returns the value of attribute config.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#name ⇒ Object
Returns the value of attribute name.
-
#poller_enabled ⇒ Object
Returns the value of attribute poller_enabled.
-
#poller_url ⇒ Object
Returns the value of attribute poller_url.
-
#queue ⇒ Object
Returns the value of attribute queue.
-
#queues ⇒ Object
Returns the value of attribute queues.
Instance Method Summary collapse
- #add_queue(name, url, poller = false) ⇒ Object
- #config_for(name) ⇒ Object
- #configure {|_self| ... } ⇒ Object
-
#initialize(env, name, poller_enabled) ⇒ Application
constructor
A new instance of Application.
- #run ⇒ Object
Constructor Details
#initialize(env, name, poller_enabled) ⇒ Application
Returns a new instance of Application.
18 19 20 21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/herdst_worker/application/facade.rb', line 18 def initialize(env, name, poller_enabled) self.name = name self.poller_enabled = poller_enabled self.queues = ActiveSupport::HashWithIndifferentAccess.new HerdstWorker.set_application(self) self.logger = HerdstWorker::Log::Facade.new(get_logger_level(env)) self.config = HerdstWorker::Configuration::Facade.new(env, name) self.autoload = HerdstWorker::Autoload::Facade.new(self) self.set_inflections HerdstWorker::Adapters::Facade.bootstrap(self) end |
Instance Attribute Details
#autoload ⇒ Object
Returns the value of attribute autoload.
14 15 16 |
# File 'lib/herdst_worker/application/facade.rb', line 14 def autoload @autoload end |
#config ⇒ Object
Returns the value of attribute config.
14 15 16 |
# File 'lib/herdst_worker/application/facade.rb', line 14 def config @config end |
#logger ⇒ Object
Returns the value of attribute logger.
14 15 16 |
# File 'lib/herdst_worker/application/facade.rb', line 14 def logger @logger end |
#name ⇒ Object
Returns the value of attribute name.
13 14 15 |
# File 'lib/herdst_worker/application/facade.rb', line 13 def name @name end |
#poller_enabled ⇒ Object
Returns the value of attribute poller_enabled.
15 16 17 |
# File 'lib/herdst_worker/application/facade.rb', line 15 def poller_enabled @poller_enabled end |
#poller_url ⇒ Object
Returns the value of attribute poller_url.
15 16 17 |
# File 'lib/herdst_worker/application/facade.rb', line 15 def poller_url @poller_url end |
#queue ⇒ Object
Returns the value of attribute queue.
15 16 17 |
# File 'lib/herdst_worker/application/facade.rb', line 15 def queue @queue end |
#queues ⇒ Object
Returns the value of attribute queues.
15 16 17 |
# File 'lib/herdst_worker/application/facade.rb', line 15 def queues @queues end |
Instance Method Details
#add_queue(name, url, poller = false) ⇒ Object
41 42 43 44 |
# File 'lib/herdst_worker/application/facade.rb', line 41 def add_queue(name, url, poller = false) self.queues[name] = url self.poller_url = url if poller end |
#config_for(name) ⇒ Object
59 60 61 |
# File 'lib/herdst_worker/application/facade.rb', line 59 def config_for(name) self.config.config_for(name) end |
#configure {|_self| ... } ⇒ Object
34 35 36 37 38 |
# File 'lib/herdst_worker/application/facade.rb', line 34 def configure(&block) yield self self.autoload.reload end |
#run ⇒ Object
47 48 49 50 51 52 53 54 55 56 |
# File 'lib/herdst_worker/application/facade.rb', line 47 def run if self.queue == nil self.logger.info "Starting Application (#{$$})" HerdstWorker::Signals::Facade.listen(self.config.paths.temp) self.queue = HerdstWorker::Queue::Facade.new(self, self.poller_enabled, self.poller_url, 20) self.queue.start end end |