class Sequent::Core::AggregateSnapshotter

Public Instance Methods

take_snapshot!(aggregate_id) click to toggle source
# File lib/sequent/core/aggregate_snapshotter.rb, line 38
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