Class: RailsTransactionalOutbox::Monitor

Inherits:
Dry::Monitor::Notifications
  • Object
show all
Defined in:
lib/rails_transactional_outbox/monitor.rb

Defined Under Namespace

Classes: UnknownEventError

Instance Method Summary collapse

Constructor Details

#initializeMonitor

Returns a new instance of Monitor.



17
18
19
20
# File 'lib/rails_transactional_outbox/monitor.rb', line 17

def initialize
  super(:rails_transactional_outbox)
  EVENTS.each { |event| register_event(event) }
end

Instance Method Details

#eventsObject



28
29
30
# File 'lib/rails_transactional_outbox/monitor.rb', line 28

def events
  EVENTS
end

#subscribe(event) ⇒ Object

Raises:



22
23
24
25
26
# File 'lib/rails_transactional_outbox/monitor.rb', line 22

def subscribe(event)
  return super if events.include?(event.to_s)

  raise UnknownEventError.new(events, event)
end