Class: RailsEventStore::AsyncProxyStrategy::AfterCommit::AsyncRecord

Inherits:
Object
  • Object
show all
Defined in:
lib/rails_event_store/active_job_dispatcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(klass, event) ⇒ AsyncRecord

Returns a new instance of AsyncRecord.



19
20
21
22
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 19

def initialize(klass, event)
  @klass = klass
  @event = event
end

Instance Method Details

#add_to_transactionObject



34
35
36
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 34

def add_to_transaction
  AfterCommit.new.call(@klass, @event)
end

#before_committed!Object



31
32
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 31

def before_committed!
end

#committed!Object



24
25
26
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 24

def committed!
  @klass.perform_later(YAML.dump(@event))
end

#rolledback!Object



28
29
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 28

def rolledback!(*)
end