Class: Chore::Fetcher
- Inherits:
-
Object
- Object
- Chore::Fetcher
- Defined in:
- lib/chore/fetcher.rb
Overview
:nodoc:
Instance Attribute Summary collapse
-
#consumers ⇒ Object
readonly
Returns the value of attribute consumers.
-
#manager ⇒ Object
readonly
Returns the value of attribute manager.
Instance Method Summary collapse
-
#initialize(manager) ⇒ Fetcher
constructor
A new instance of Fetcher.
-
#provide_work(n) ⇒ Object
returns upto n work units.
-
#return_work(work_units) ⇒ Object
gives work back to the consumer in case it couldn't be assigned.
-
#start ⇒ Object
Starts the fetcher with the configured Consumer Strategy.
-
#stop! ⇒ Object
Stops the fetcher, preventing any further messages from being pulled from the queue.
-
#stopping? ⇒ Boolean
Determines in the fetcher is in the process of stopping.
Constructor Details
Instance Attribute Details
#consumers ⇒ Object (readonly)
Returns the value of attribute consumers.
3 4 5 |
# File 'lib/chore/fetcher.rb', line 3 def consumers @consumers end |
#manager ⇒ Object (readonly)
Returns the value of attribute manager.
3 4 5 |
# File 'lib/chore/fetcher.rb', line 3 def manager @manager end |
Instance Method Details
#provide_work(n) ⇒ Object
returns upto n work units
33 34 35 |
# File 'lib/chore/fetcher.rb', line 33 def provide_work(n) @strategy.provide_work(n) end |
#return_work(work_units) ⇒ Object
gives work back to the consumer in case it couldn't be assigned
38 39 40 |
# File 'lib/chore/fetcher.rb', line 38 def return_work(work_units) @strategy.return_work(work_units) end |
#start ⇒ Object
Starts the fetcher with the configured Consumer Strategy. This will begin consuming messages from your queue
12 13 14 15 |
# File 'lib/chore/fetcher.rb', line 12 def start Chore.logger.info "Fetcher starting up" @strategy.fetch end |
#stop! ⇒ Object
Stops the fetcher, preventing any further messages from being pulled from the queue
18 19 20 21 22 23 24 25 |
# File 'lib/chore/fetcher.rb', line 18 def stop! unless @stopping Chore.logger.info "Fetcher shutting down started" @stopping = true @strategy.stop! Chore.logger.info "Fetcher shutting down completed" end end |
#stopping? ⇒ Boolean
Determines in the fetcher is in the process of stopping
28 29 30 |
# File 'lib/chore/fetcher.rb', line 28 def stopping? @stopping end |