Class: Materialist::EventHandler

Inherits:
Object
  • Object
show all
Defined in:
lib/materialist/event_handler.rb

Constant Summary collapse

DEFAULT_OPTIONS =

10 retries takes approximately 6 hours

{ retry: 10 }

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ EventHandler

Returns a new instance of EventHandler.



10
11
12
# File 'lib/materialist/event_handler.rb', line 10

def initialize(options={})
  @options = DEFAULT_OPTIONS.merge(options)
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