Class: EventSourcing::Event::Bus

Inherits:
Concurrent::Actor::RestartingContext
  • Object
show all
Defined in:
lib/event_sourcing/event/bus.rb,
lib/event_sourcing/event/bus/reference.rb

Defined Under Namespace

Classes: Reference

Instance Method Summary collapse

Constructor Details

#initialize(event_store) ⇒ Bus

Returns a new instance of Bus.



10
11
12
13
# File 'lib/event_sourcing/event/bus.rb', line 10

def initialize(event_store)
  @store = event_store
  @publisher = Publisher.spawn!(name: :event_publisher, supervise: true)
end

Instance Method Details

#default_reference_classObject



24
25
26
# File 'lib/event_sourcing/event/bus.rb', line 24

def default_reference_class
  Reference
end

#on_message(message) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/event_sourcing/event/bus.rb', line 15

def on_message(message)
  case message
  when :get_event_publisher
    @publisher
  when :get_event_store
    @store
  end
end