Class: RailsEventStore::ActiveJobDispatcher

Inherits:
Object
  • 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.



38
39
40
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 38

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

Instance Method Details

#call(subscriber, event) ⇒ Object



42
43
44
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 42

def call(subscriber, event)
  subscriber.call(event)
end

#proxy_for(klass) ⇒ Object



46
47
48
# File 'lib/rails_event_store/active_job_dispatcher.rb', line 46

def proxy_for(klass)
  async_handler?(klass) ? async_proxy(klass) : sync_proxy(klass)
end