Class: Sequent::Core::AggregateSnapshotter

Inherits:
BaseCommandHandler show all
Defined in:
lib/sequent/core/aggregate_snapshotter.rb

Instance Method Summary collapse

Methods included from Helpers::MessageHandler

#handle_message, included

Methods included from Helpers::UuidHelper

new_uuid

Instance Method Details

#take_snapshot!(aggregate_id) ⇒ Object



34
35
36
37
38
39
40
# File 'lib/sequent/core/aggregate_snapshotter.rb', line 34

def take_snapshot!(aggregate_id)
  aggregate = repository.load_aggregate(aggregate_id)
  Sequent.logger.info "Taking snapshot for aggregate #{aggregate}"
  aggregate.take_snapshot!
rescue StandardError => e
  Sequent.logger.error("Failed to take snapshot for aggregate #{aggregate_id}: #{e}, #{e.inspect}")
end