lib/event_sourcery/config.rb in event_sourcery-0.21.0 vs lib/event_sourcery/config.rb in event_sourcery-0.22.0
- old
+ new
@@ -17,10 +17,18 @@
# i.e. report to an error reporting service like Rollbar.
#
# @return Proc
attr_accessor :on_event_processor_error
+ # A Proc to be executed on an event processor critical error.
+ # App defined behaviour can be provided. This will be called
+ # if an exception causes an a event processor to die.
+ # i.e. report to an error reporting service like Rollbar.
+ #
+ # @return Proc
+ attr_accessor :on_event_processor_critical_error
+
# @return EventStore::EventTypeSerializers::Underscored
attr_accessor :event_type_serializer
# @return EventProcessing::ErrorHandlers::ConstantRetry
attr_accessor :error_handler_class
@@ -36,9 +44,12 @@
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 an error reporting service like Rollbar.
+ }
+ @on_event_processor_critical_error = proc { |exception, processor_name|
# app specific custom logic ie. report to an error reporting service like Rollbar.
}
@event_builder = nil
@event_type_serializer = EventStore::EventTypeSerializers::Underscored.new
@error_handler_class = EventProcessing::ErrorHandlers::ConstantRetry