Class: Synapse::EventSourcing::CapturingEventStream
Overview
Event stream decorator that captures any events that have been applied after the expected version of an aggregate
Instance Method Summary
collapse
#each, #end?, #peek, #to_a
Constructor Details
#initialize(delegate, unseen_events, expected_version) ⇒ undefined
73
74
75
76
77
|
# File 'lib/synapse/event_sourcing/conflict_resolver.rb', line 73
def initialize(delegate, unseen_events, expected_version)
@delegate = delegate
@unseen_events = unseen_events
@expected_version = expected_version
end
|
Instance Method Details
#next_event ⇒ DomainEventMessage
80
81
82
83
84
85
86
|
# File 'lib/synapse/event_sourcing/conflict_resolver.rb', line 80
def next_event
@delegate.next_event.tap do |event|
if @expected_version and event.sequence_number > @expected_version
@unseen_events.push event
end
end
end
|