Class: NtiEventBus::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/nti_event_bus/configuration.rb

Overview

Runtime configuration. On Rails the Railtie fills in path defaults; hosts may override any of it.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initializeConfiguration

Returns a new instance of Configuration.



17
18
19
20
21
22
23
# File 'lib/nti_event_bus/configuration.rb', line 17

def initialize
  @queue_name = :events
  @root_events_file = nil
  @events_dir = nil
  @logger = nil
  @dispatcher = nil
end

Instance Attribute Details

#dispatcherObject

Object responding to #call(handler_name, payload). Defaults to asynchronous ActiveJob dispatch.



26
27
28
# File 'lib/nti_event_bus/configuration.rb', line 26

def dispatcher
  @dispatcher ||= Dispatchers::ActiveJob.new
end

#events_dirObject

Absolute path to the directory that draw resolves nested event files from (e.g. config/events).



9
10
11
# File 'lib/nti_event_bus/configuration.rb', line 9

def events_dir
  @events_dir
end

#loggerObject

Optional logger; when set, receives debug lines from the bus.



13
14
15
# File 'lib/nti_event_bus/configuration.rb', line 13

def logger
  @logger
end

#queue_nameObject

ActiveJob queue used by the default dispatcher.



11
12
13
# File 'lib/nti_event_bus/configuration.rb', line 11

def queue_name
  @queue_name
end

#root_events_fileObject

Absolute path to the root events file that is evaluated by setup! (e.g. config/events.rb).



7
8
9
# File 'lib/nti_event_bus/configuration.rb', line 7

def root_events_file
  @root_events_file
end

Instance Method Details

#root_events_file!Object



30
31
32
33
# File 'lib/nti_event_bus/configuration.rb', line 30

def root_events_file!
  root_events_file ||
    raise(NotConfiguredError, 'NtiEventBus.configuration.root_events_file must be set')
end