Class: RailsEventSourcing::ReactorJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/rails-event-sourcing/reactor_job.rb

Instance Method Summary collapse

Instance Method Details

#perform(event, reactor_class) ⇒ Object



6
7
8
9
10
11
# File 'lib/rails-event-sourcing/reactor_job.rb', line 6

def perform(event, reactor_class)
  reactor = reactor_class.constantize
  if reactor.ancestors.include? RailsEventSourcing::BaseEvent
    reactor.create!(aggregate: event.aggregate)
  end
end