Class: ActiveEvent::EventSourceServer

Inherits:
Object
  • Object
show all
Includes:
Singleton
Defined in:
lib/active_event/event_source_server.rb

Defined Under Namespace

Classes: Status

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.fail_on_projection_error(projection) ⇒ Object



20
21
22
# File 'lib/active_event/event_source_server.rb', line 20

def fail_on_projection_error(projection)
  instance.fail_on_projection_error(projection)
end

.wait_for_event_projection(event_id, projection, options = {}) ⇒ Object



16
17
18
# File 'lib/active_event/event_source_server.rb', line 16

def wait_for_event_projection(event_id, projection, options = {})
  instance.wait_for_event_projection(event_id, projection, options)
end

Instance Method Details

#fail_on_projection_error(projection) ⇒ Object



34
35
36
37
38
39
# File 'lib/active_event/event_source_server.rb', line 34

def fail_on_projection_error(projection)
  mutex.synchronize do
    projection_status = status[projection]
    projection_status.fail_on_error
  end
end

#wait_for_event_projection(event_id, projection, options = {}) ⇒ Object



25
26
27
28
29
30
31
32
# File 'lib/active_event/event_source_server.rb', line 25

def wait_for_event_projection(event_id, projection, options = {})
  mutex.synchronize do
    projection_status = status[projection]
    projection_status.fail_on_error # projection will not continue if error occurred
    projection_status.waiter(event_id).wait(mutex, options[:timeout])
    projection_status.fail_on_error
  end
end