Class: HasuraHandler::EventProcessor
- Inherits:
-
Object
- Object
- HasuraHandler::EventProcessor
- Defined in:
- lib/hasura_handler/event_processor.rb
Instance Attribute Summary collapse
-
#event ⇒ Object
Returns the value of attribute event.
Instance Method Summary collapse
-
#initialize(event) ⇒ EventProcessor
constructor
A new instance of EventProcessor.
- #process ⇒ Object
- #process_later ⇒ Object
Constructor Details
#initialize(event) ⇒ EventProcessor
Returns a new instance of EventProcessor.
5 6 7 |
# File 'lib/hasura_handler/event_processor.rb', line 5 def initialize(event) @event = HasuraHandler::Event.new(event) end |
Instance Attribute Details
#event ⇒ Object
Returns the value of attribute event.
3 4 5 |
# File 'lib/hasura_handler/event_processor.rb', line 3 def event @event end |
Instance Method Details
#process ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/hasura_handler/event_processor.rb', line 18 def process unless event_handlers.present? log_missing_handler return end event_handlers.each do |handler_class| if HasuraHandler.fanout_events HasuraHandler::EventHandlerJob.perform_later(handler_class.to_s, @event.raw_event) else handler = handler_class.new(@event) handler.run end end end |
#process_later ⇒ Object
9 10 11 12 13 14 15 16 |
# File 'lib/hasura_handler/event_processor.rb', line 9 def process_later unless event_handlers.present? log_missing_handler return end HasuraHandler::EventJob.perform_later(@event.raw_event) end |