Module: EventSourcery

Defined in:
lib/event_sourcery.rb,
lib/event_sourcery/event.rb,
lib/event_sourcery/config.rb,
lib/event_sourcery/errors.rb,
lib/event_sourcery/version.rb,
lib/event_sourcery/repository.rb,
lib/event_sourcery/memory/config.rb,
lib/event_sourcery/aggregate_root.rb,
lib/event_sourcery/memory/tracker.rb,
lib/event_sourcery/memory/projector.rb,
lib/event_sourcery/memory/event_store.rb,
lib/event_sourcery/event_body_serializer.rb,
lib/event_sourcery/event_store/event_sink.rb,
lib/event_sourcery/event_store/poll_waiter.rb,
lib/event_sourcery/event_store/event_source.rb,
lib/event_sourcery/event_store/subscription.rb,
lib/event_sourcery/event_store/each_by_range.rb,
lib/event_sourcery/event_store/event_builder.rb,
lib/event_sourcery/event_processing/esp_runner.rb,
lib/event_sourcery/event_processing/esp_process.rb,
lib/event_sourcery/event_processing/event_stream_processor.rb,
lib/event_sourcery/event_processing/error_handlers/no_retry.rb,
lib/event_sourcery/event_store/event_type_serializers/legacy.rb,
lib/event_sourcery/event_processing/error_handlers/error_handler.rb,
lib/event_sourcery/event_store/event_type_serializers/class_name.rb,
lib/event_sourcery/event_processing/error_handlers/constant_retry.rb,
lib/event_sourcery/event_store/event_type_serializers/underscored.rb,
lib/event_sourcery/event_store/signal_handling_subscription_master.rb,
lib/event_sourcery/event_processing/event_stream_processor_registry.rb,
lib/event_sourcery/event_processing/error_handlers/exponential_backoff_retry.rb

Defined Under Namespace

Modules: AggregateRoot, EventProcessing, EventStore, Memory Classes: Config, Event, EventBodySerializer, EventProcessingError, Repository

Constant Summary collapse

Error =
Class.new(StandardError)
UnableToLockProcessorError =
Class.new(Error)
ConcurrencyError =
Class.new(Error)
AtomicWriteToMultipleAggregatesNotSupported =
Class.new(Error)
MultipleCatchAllHandlersDefined =
Class.new(Error)
VERSION =

Defines the version

'0.23.1'.freeze

Class Method Summary collapse

Class Method Details

.configObject


60
61
62
# File 'lib/event_sourcery.rb', line 60

def self.config
  @config ||= Config.new
end

.configure {|config| ... } ⇒ Object

Configure EventSourcery

Examples:

EventSourcery.configure do |config|
  # Add custom reporting of errors occurring during event processing.
  # One might set up an error reporting service like Rollbar here.
  config.on_event_processor_error = proc { |exception, processor_name|  }

  # Enable Event Sourcery logging.
  config.logger = Logger.new('logs/my_event_sourcery_app.log')

  # Customize how event body attributes are serialized
  config.event_body_serializer
    .add(BigDecimal) { |decimal| decimal.to_s('F') }

  # Config how you want to handle event processing errors
  config.error_handler_class = EventSourcery::EventProcessing::ErrorHandlers::ExponentialBackoffRetry
end

Yields:

See Also:


56
57
58
# File 'lib/event_sourcery.rb', line 56

def self.configure
  yield config
end

.event_stream_processor_registryObject

Registry of all Event Stream Processors

Returns:

  • EventProcessing::EventStreamProcessorRegistry


74
75
76
# File 'lib/event_sourcery.rb', line 74

def self.event_stream_processor_registry
  @event_stream_processor_registry ||= EventProcessing::EventStreamProcessorRegistry.new
end

.loggerObject

Logger object used by EventSourcery. Set via `configure`.


67
68
69
# File 'lib/event_sourcery.rb', line 67

def self.logger
  config.logger
end