Class: Euston::EventStore::Dispatcher::SynchronousDispatcher
- Inherits:
-
Object
- Object
- Euston::EventStore::Dispatcher::SynchronousDispatcher
- Defined in:
- lib/euston-eventstore/dispatcher/synchronous_dispatcher.rb
Instance Method Summary collapse
- #dispatch(commit) ⇒ Object
-
#initialize(persistence, &block) ⇒ SynchronousDispatcher
constructor
A new instance of SynchronousDispatcher.
- #lookup ⇒ Object
Constructor Details
#initialize(persistence, &block) ⇒ SynchronousDispatcher
Returns a new instance of SynchronousDispatcher.
5 6 7 8 |
# File 'lib/euston-eventstore/dispatcher/synchronous_dispatcher.rb', line 5 def initialize persistence, &block @persistence = persistence @dispatch = block end |
Instance Method Details
#dispatch(commit) ⇒ Object
10 11 12 13 |
# File 'lib/euston-eventstore/dispatcher/synchronous_dispatcher.rb', line 10 def dispatch commit @dispatch.call commit @persistence.mark_commit_as_dispatched commit end |
#lookup ⇒ Object
15 16 17 |
# File 'lib/euston-eventstore/dispatcher/synchronous_dispatcher.rb', line 15 def lookup @persistence.get_undispatched_commits.each { |commit| dispatch commit } end |