Class: Hecks::Runtime::SagaInterpreter

Inherits:
Object
  • Object
show all
Includes:
Correlation
Defined in:
lib/hecks/runtime/saga_interpreter.rb,
lib/hecks/runtime/saga_interpreter/correlation.rb

Defined Under Namespace

Modules: Correlation

Constant Summary collapse

REFUSED =

The trigger lives on the declaration it triggers, not on the runtime that notices it — see ProcessManager::REFUSED.

Bluebook::ProcessManager::REFUSED
MAX_DEFECT_RETRIES =

A crash gets this many extra attempts before the procedure gives up and treats it as something to compensate for — see deliver_saga_dispatch's own comment for why a crash isn't unwound on the first failure the way a domain refusal is.

3

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(registry, door:) ⇒ SagaInterpreter

Returns a new instance of SagaInterpreter.



25
26
27
28
# File 'lib/hecks/runtime/saga_interpreter.rb', line 25

def initialize(registry, door:)
  @registry = registry
  @door     = door
end

Instance Attribute Details

#registryObject (readonly)

Returns the value of attribute registry.



23
24
25
# File 'lib/hecks/runtime/saga_interpreter.rb', line 23

def registry
  @registry
end

Instance Method Details

#advance(event, domain) ⇒ Object



30
31
32
33
34
35
36
37
38
39
# File 'lib/hecks/runtime/saga_interpreter.rb', line 30

def advance(event, domain)
  bluebook = @registry.bluebook(domain)
  return unless bluebook

  bluebook.process_managers.each do |pm|
    begin_saga(pm, event, domain)
    advance_saga(pm, event, domain)
    end_saga(pm, event, domain)
  end
end