Class: Euston::EventStore::Dispatcher::AsynchronousDispatcher
- Inherits:
-
Object
- Object
- Euston::EventStore::Dispatcher::AsynchronousDispatcher
- Defined in:
- lib/euston-eventstore/dispatcher/asynchronous_dispatcher.rb
Instance Method Summary collapse
- #dispatch(commit) ⇒ Object
-
#initialize(bus, persistence, &block) ⇒ AsynchronousDispatcher
constructor
A new instance of AsynchronousDispatcher.
Constructor Details
#initialize(bus, persistence, &block) ⇒ AsynchronousDispatcher
Returns a new instance of AsynchronousDispatcher.
5 6 7 8 9 10 11 |
# File 'lib/euston-eventstore/dispatcher/asynchronous_dispatcher.rb', line 5 def initialize(bus, persistence, &block) @bus = bus @persistence = persistence @handle_exception = block_given? ? block : Proc.new {} start end |
Instance Method Details
#dispatch(commit) ⇒ Object
13 14 15 |
# File 'lib/euston-eventstore/dispatcher/asynchronous_dispatcher.rb', line 13 def dispatch(commit) Thread.fork(commit) { |c| begin_dispatch c } end |