Sha256: eed1f6ac1c1ee8f4e5cf4b0c57004d1bed0514f25cfa857b0e8e4746865034da
Contents?: true
Size: 1.3 KB
Versions: 2
Compression:
Stored size: 1.3 KB
Contents
require 'logger' module EventSourcery class Config attr_accessor :on_unknown_event, :on_event_processor_error, :event_type_serializer, :error_handler_class attr_writer :logger, :event_body_serializer, :event_builder def initialize @on_unknown_event = proc { |event, aggregate| raise AggregateRoot::UnknownEventError, "#{event.type} is unknown to #{aggregate.class.name}" } @on_event_processor_error = proc { |exception, processor_name| # app specific custom logic ie. report to rollbar } @event_store = nil @event_type_serializer = EventStore::EventTypeSerializers::Underscored.new @error_handler_class = EventProcessing::ErrorHandlers::ConstantRetry end def logger @logger ||= ::Logger.new(STDOUT).tap do |logger| logger.level = Logger::DEBUG end end def event_builder @event_builder || EventStore::EventBuilder.new(event_type_serializer: @event_type_serializer) end def event_body_serializer @event_body_serializer ||= EventBodySerializer.new .add(Hash, EventBodySerializer::HashSerializer) .add(Array, EventBodySerializer::ArraySerializer) .add(Time, &:iso8601) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
event_sourcery-0.14.0 | lib/event_sourcery/config.rb |
event_sourcery-0.13.0 | lib/event_sourcery/config.rb |