Class: Materialist::EventHandler
- Inherits:
-
Object
- Object
- Materialist::EventHandler
- Defined in:
- lib/materialist/event_handler.rb
Constant Summary collapse
- DEFAULT_OPTIONS =
10 retries takes approximately 6 hours
{ retry: 10 }
Instance Method Summary collapse
- #call(event) ⇒ Object
-
#initialize(options = {}) ⇒ EventHandler
constructor
A new instance of EventHandler.
- #on_events_received(batch) ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ EventHandler
Returns a new instance of EventHandler.
10 11 12 |
# File 'lib/materialist/event_handler.rb', line 10 def initialize(={}) = DEFAULT_OPTIONS.merge() end |
Instance Method Details
#call(event) ⇒ Object
18 19 20 |
# File 'lib/materialist/event_handler.rb', line 18 def call(event) worker.perform_async(event) end |
#on_events_received(batch) ⇒ Object
14 15 16 |
# File 'lib/materialist/event_handler.rb', line 14 def on_events_received(batch) batch.each { |event| call(event) if topics.include?(event['topic'].to_s) } end |