Class: RubyEventStore::AsyncDispatcher Deprecated

Inherits:
PubSub::Dispatcher show all
Defined in:
lib/ruby_event_store/async_dispatcher.rb

Overview

Deprecated.

Use RubyEventStore::ImmediateAsyncDispatcher instead

Instance Method Summary collapse

Constructor Details

#initialize(proxy_strategy: AsyncProxyStrategy::Inline.new, scheduler:) ⇒ AsyncDispatcher

Returns a new instance of AsyncDispatcher.



4
5
6
7
8
9
10
11
12
# File 'lib/ruby_event_store/async_dispatcher.rb', line 4

def initialize(proxy_strategy: AsyncProxyStrategy::Inline.new, scheduler:)
  @async_proxy_strategy = proxy_strategy
  @scheduler = scheduler
  warn <<~EOW
    RubyEventStore::AsyncDispatcher has been deprecated.

    Use RubyEventStore::ImmediateAsyncDispatcher instead
  EOW
end

Instance Method Details

#call(subscriber, _, serialized_event) ⇒ Object



14
15
16
17
18
19
20
# File 'lib/ruby_event_store/async_dispatcher.rb', line 14

def call(subscriber, _, serialized_event)
  if @scheduler.async_handler?(subscriber)
    @async_proxy_strategy.call(->{ @scheduler.call(subscriber, serialized_event) })
  else
    super
  end
end

#verify(subscriber) ⇒ Object



22
23
24
# File 'lib/ruby_event_store/async_dispatcher.rb', line 22

def verify(subscriber)
  @scheduler.async_handler?(subscriber) || super
end