Class: Synapse::Configuration::EventSourcingRepositoryDefinitionBuilder
- Inherits:
-
LockingRepositoryDefinitionBuilder
- Object
- DefinitionBuilder
- LockingRepositoryDefinitionBuilder
- Synapse::Configuration::EventSourcingRepositoryDefinitionBuilder
- Defined in:
- lib/synapse/configuration/component/event_sourcing/repository.rb
Overview
Definition builder used to create event sourced aggregate repositories
Instance Attribute Summary
Attributes inherited from DefinitionBuilder
Instance Method Summary collapse
-
#use_aggregate_factory(aggregate_factory) ⇒ undefined
Changes the aggregate factory used to create aggregates that will have their state initialized from an event stream.
-
#use_aggregate_type(aggregate_type) ⇒ undefined
Convenience method that defines an aggregate factory capable of creating aggregates of the given type.
-
#use_cache(cache) ⇒ undefined
Changes the cache store that will be used to cache aggregates.
- #use_conflict_resolver(conflict_resolver) ⇒ undefined
- #use_event_store(event_store) ⇒ undefined
- #use_snapshot_policy(snapshot_policy) ⇒ undefined
- #use_snapshot_taker(snapshot_taker) ⇒ undefined
Methods inherited from LockingRepositoryDefinitionBuilder
#use_event_bus, #use_lock_manager, #use_no_locking, #use_optimistic_locking, #use_pessimistic_locking, #use_unit_provider
Methods inherited from DefinitionBuilder
#anonymous, #as_prototype, #as_singleton, build, #build_composite, #build_definition, #clear_tags, #identified_by, #initialize, #register_definition, #replace_tags, #tag, #use_factory, #use_instance
Constructor Details
This class inherits a constructor from Synapse::Configuration::DefinitionBuilder
Instance Method Details
#use_aggregate_factory(aggregate_factory) ⇒ undefined
Changes the aggregate factory used to create aggregates that will have their state initialized from an event stream
45 46 47 |
# File 'lib/synapse/configuration/component/event_sourcing/repository.rb', line 45 def use_aggregate_factory(aggregate_factory) @aggregate_factory = aggregate_factory end |
#use_aggregate_type(aggregate_type) ⇒ undefined
Convenience method that defines an aggregate factory capable of creating aggregates of the given type
Definitions have to be created by aggregate factories so that aggregate factories can be registered to an aggregate snapshot taker.
29 30 31 32 33 34 35 36 37 |
# File 'lib/synapse/configuration/component/event_sourcing/repository.rb', line 29 def use_aggregate_type(aggregate_type) @aggregate_factory = build_composite do anonymous tag :aggregate_factory use_factory do EventSourcing::GenericAggregateFactory.new aggregate_type end end end |
#use_cache(cache) ⇒ undefined
Changes the cache store that will be used to cache aggregates
Note that if this is set, a caching implementation of the repository will be used in place of the non-caching implementation
57 58 59 |
# File 'lib/synapse/configuration/component/event_sourcing/repository.rb', line 57 def use_cache(cache) @cache = cache end |
#use_conflict_resolver(conflict_resolver) ⇒ undefined
64 65 66 |
# File 'lib/synapse/configuration/component/event_sourcing/repository.rb', line 64 def use_conflict_resolver(conflict_resolver) @conflict_resolver = conflict_resolver end |
#use_event_store(event_store) ⇒ undefined
71 72 73 |
# File 'lib/synapse/configuration/component/event_sourcing/repository.rb', line 71 def use_event_store(event_store) @event_store = event_store end |
#use_snapshot_policy(snapshot_policy) ⇒ undefined
78 79 80 |
# File 'lib/synapse/configuration/component/event_sourcing/repository.rb', line 78 def use_snapshot_policy(snapshot_policy) @snapshot_policy = snapshot_policy end |
#use_snapshot_taker(snapshot_taker) ⇒ undefined
85 86 87 |
# File 'lib/synapse/configuration/component/event_sourcing/repository.rb', line 85 def use_snapshot_taker(snapshot_taker) @snapshot_taker = snapshot_taker end |