Class: Osbourne::WorkerBase
- Inherits:
-
Object
- Object
- Osbourne::WorkerBase
- Defined in:
- lib/osbourne/worker_base.rb
Class Attribute Summary collapse
-
.config ⇒ Object
Returns the value of attribute config.
-
.queue ⇒ Object
Returns the value of attribute queue.
-
.subscriptions ⇒ Object
Returns the value of attribute subscriptions.
-
.topics ⇒ Object
Returns the value of attribute topics.
Class Method Summary collapse
Instance Method Summary collapse
- #config ⇒ Object
- #config=(config) ⇒ Object
- #polling_queue ⇒ Object
- #process(_message) ⇒ Object
- #queue ⇒ Object
Class Attribute Details
.config ⇒ Object
Returns the value of attribute config.
28 29 30 |
# File 'lib/osbourne/worker_base.rb', line 28 def config @config end |
.queue ⇒ Object
Returns the value of attribute queue.
28 29 30 |
# File 'lib/osbourne/worker_base.rb', line 28 def queue @queue end |
.subscriptions ⇒ Object
Returns the value of attribute subscriptions.
28 29 30 |
# File 'lib/osbourne/worker_base.rb', line 28 def subscriptions @subscriptions end |
.topics ⇒ Object
Returns the value of attribute topics.
28 29 30 |
# File 'lib/osbourne/worker_base.rb', line 28 def topics @topics end |
Class Method Details
.dead_letter_queue ⇒ Object
39 40 41 42 43 |
# File 'lib/osbourne/worker_base.rb', line 39 def dead_letter_queue return unless config[:dead_letter] @dead_letter_queue ||= Queue.new(dead_letter_queue_name) end |
.descendants ⇒ Object
30 31 32 |
# File 'lib/osbourne/worker_base.rb', line 30 def descendants ObjectSpace.each_object(Class).select {|klass| klass < self } end |
.polling_queue ⇒ Object
45 46 47 |
# File 'lib/osbourne/worker_base.rb', line 45 def polling_queue Aws::SQS::QueuePoller.new(queue.url, client: Osbourne.sqs_client) end |
.provision ⇒ Object
34 35 36 37 |
# File 'lib/osbourne/worker_base.rb', line 34 def provision register register_dead_letter_queue end |
Instance Method Details
#config ⇒ Object
7 8 9 |
# File 'lib/osbourne/worker_base.rb', line 7 def config self.class.config end |
#config=(config) ⇒ Object
15 16 17 |
# File 'lib/osbourne/worker_base.rb', line 15 def config=(config) self.class.config = config end |
#polling_queue ⇒ Object
23 24 25 |
# File 'lib/osbourne/worker_base.rb', line 23 def polling_queue @polling_queue ||= self.class.polling_queue end |
#process(_message) ⇒ Object
11 12 13 |
# File 'lib/osbourne/worker_base.rb', line 11 def process() raise NotImplementedError, "#{self} must implement class method `process`" end |
#queue ⇒ Object
19 20 21 |
# File 'lib/osbourne/worker_base.rb', line 19 def queue self.class.queue end |