Class: ActiveProjection::EventClient

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/active_projection/event_client.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.start(options) ⇒ Object



8
9
10
# File 'lib/active_projection/event_client.rb', line 8

def self.start(options)
  instance.configure(options).start
end

Instance Method Details

#configure(options) ⇒ Object



12
13
14
15
16
# File 'lib/active_projection/event_client.rb', line 12

def configure(options)
  raise 'Unsupported! Cannot configure running client' if running
  self.options = options
  self
end

#startObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
# File 'lib/active_projection/event_client.rb', line 18

def start
  run_once do
    prepare
    sync_projections
    listen_for_events
    listen_for_replayed_events
    request_missing_events
    event_channel.work_pool.join
  end
rescue Interrupt
  LOGGER.info 'Catching Interrupt'
rescue Exception => e
  LOGGER.error e.message
  LOGGER.error e.backtrace.join("\n")
  raise
end