Class: RailsEventStore::ActiveJobDispatcher

Inherits:
RubyEventStore::PubSub::Dispatcher
  • Object
show all
Defined in:
lib/rails_event_store/active_job_dispatcher.rb

Instance Method Summary collapse

Constructor Details

#initialize(proxy_strategy: AsyncProxyStrategy::Inline.new) ⇒ ActiveJobDispatcher

Returns a new instance of ActiveJobDispatcher.



48
49
50
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 48

def initialize(proxy_strategy: AsyncProxyStrategy::Inline.new)
  @async_proxy_strategy = proxy_strategy
end

Instance Method Details

#call(subscriber, event) ⇒ Object



52
53
54
55
56
57
58
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 52

def call(subscriber, event)
  if async_handler?(subscriber)
    @async_proxy_strategy.call(subscriber, event)
  else
    super
  end
end

#verify(subscriber) ⇒ Object



60
61
62
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 60

def verify(subscriber)
  super unless async_handler?(subscriber)
end