Class: RubyReactor::Dsl::InterruptBuilder
- Inherits:
-
StepBuilder
- Object
- StepBuilder
- RubyReactor::Dsl::InterruptBuilder
- Defined in:
- lib/ruby_reactor/dsl/interrupt_builder.rb
Instance Attribute Summary
Attributes inherited from StepBuilder
#args_validator, #arguments, #compensate_block, #conditions, #dependencies, #guards, #impl, #name, #output_validator, #retry_config, #run_block, #undo_block
Instance Method Summary collapse
- #build ⇒ Object
- #correlation_id(&block) ⇒ Object
-
#initialize(name, reactor = nil) ⇒ InterruptBuilder
constructor
A new instance of InterruptBuilder.
- #max_attempts(count) ⇒ Object
- #timeout(seconds, strategy: :lazy) ⇒ Object
- #validate(&block) ⇒ Object
Methods inherited from StepBuilder
#argument, #async, #compensate, #guard, #retries, #run, #undo, #validate_args, #validate_output, #wait_for, #where
Methods included from ValidationHelpers
#build_validation_schema, #create_input_validator
Methods included from TemplateHelpers
#Failure, #Success, #element, #input, #result, #value
Constructor Details
#initialize(name, reactor = nil) ⇒ InterruptBuilder
Returns a new instance of InterruptBuilder.
6 7 8 9 10 11 12 |
# File 'lib/ruby_reactor/dsl/interrupt_builder.rb', line 6 def initialize(name, reactor = nil) super(name, nil, reactor) @correlation_id_block = nil @timeout_config = nil @validation_schema = nil @max_attempts = 1 end |
Instance Method Details
#build ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 |
# File 'lib/ruby_reactor/dsl/interrupt_builder.rb', line 31 def build step_config = { name: @name, correlation_id_block: @correlation_id_block, timeout_config: @timeout_config, validation_schema: @validation_schema, max_attempts: @max_attempts, dependencies: @dependencies, async: false, # Interrupts are effectively boundaries, not async jobs themselves (until resumed) conditions: @conditions, guards: @guards } RubyReactor::Dsl::InterruptStepConfig.new(step_config) end |
#correlation_id(&block) ⇒ Object
18 19 20 |
# File 'lib/ruby_reactor/dsl/interrupt_builder.rb', line 18 def correlation_id(&block) @correlation_id_block = block end |
#max_attempts(count) ⇒ Object
14 15 16 |
# File 'lib/ruby_reactor/dsl/interrupt_builder.rb', line 14 def max_attempts(count) @max_attempts = count end |
#timeout(seconds, strategy: :lazy) ⇒ Object
22 23 24 |
# File 'lib/ruby_reactor/dsl/interrupt_builder.rb', line 22 def timeout(seconds, strategy: :lazy) @timeout_config = { duration: seconds, strategy: strategy } end |
#validate(&block) ⇒ Object
26 27 28 29 |
# File 'lib/ruby_reactor/dsl/interrupt_builder.rb', line 26 def validate(&block) check_dry_validation_available! @validation_schema = build_validation_schema(&block) end |