Module: ActiveWorkflow

Defined in:
lib/active_workflow.rb,
lib/active_workflow/task.rb,
lib/active_workflow/errors.rb,
lib/active_workflow/context.rb,
lib/active_workflow/railtie.rb,
lib/active_workflow/version.rb,
lib/active_workflow/workflow.rb,
lib/active_workflow/dsl/steps.rb,
lib/active_workflow/execution.rb,
lib/active_workflow/dsl/options.rb,
lib/active_workflow/dsl/signals.rb,
lib/active_workflow/stores/base.rb,
lib/active_workflow/configuration.rb,
lib/active_workflow/jobs/runner_job.rb,
lib/active_workflow/serializers/json.rb,
lib/active_workflow/stores/active_record.rb,
lib/generators/active_workflow/install/install_generator.rb,
lib/generators/active_workflow/workflow/workflow_generator.rb

Defined Under Namespace

Modules: DSL, Errors, Generators, Jobs, Serializers, Stores Classes: Configuration, Context, Execution, Railtie, Task, Workflow

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.complete_step!(execution_id, step_name, payload: nil, idempotency_key: nil) ⇒ Object

Entry point for async completions. Delegates to store and runner.



56
57
58
59
60
# File 'lib/active_workflow.rb', line 56

def complete_step!(execution_id, step_name, payload: nil, idempotency_key: nil)
  with_instrumentation("complete", execution_id, step_name) do
    store.complete_step!(execution_id, step_name.to_s, payload: payload, idempotency_key: idempotency_key)
  end
end

.configurationActiveWorkflow::Configuration



32
33
34
# File 'lib/active_workflow.rb', line 32

def configuration
  @configuration ||= Configuration.new
end

.configure {|config| ... } ⇒ Object

Yields global configuration block and memoizes the configuration instance.

Yield Parameters:



39
40
41
# File 'lib/active_workflow.rb', line 39

def configure
  yield(configuration)
end

.extend_timeout!(execution_id, step_name, by:) ⇒ Object



72
73
74
# File 'lib/active_workflow.rb', line 72

def extend_timeout!(execution_id, step_name, by:)
  store.extend_timeout!(execution_id, step_name.to_s, by: by)
end

.fail_step!(execution_id, step_name, error_class:, message:, details: {}, idempotency_key: nil) ⇒ Object



62
63
64
65
66
67
68
69
70
# File 'lib/active_workflow.rb', line 62

def fail_step!(execution_id, step_name, error_class:, message:, details: {}, idempotency_key: nil)
  with_instrumentation("fail", execution_id, step_name) do
    store.fail_step!(execution_id, step_name.to_s,
      error_class: error_class,
      message: message,
      details: details,
      idempotency_key: idempotency_key)
  end
end

.heartbeat!(execution_id, step_name, at: configuration.clock.call) ⇒ Object



76
77
78
# File 'lib/active_workflow.rb', line 76

def heartbeat!(execution_id, step_name, at: configuration.clock.call)
  store.heartbeat!(execution_id, step_name.to_s, at: at)
end

.reset_configuration!Object

Resets configuration (mainly for tests)



44
45
46
# File 'lib/active_workflow.rb', line 44

def reset_configuration!
  @configuration = Configuration.new
end

.signal!(execution_id, name, payload: nil) ⇒ Object



80
81
82
83
84
# File 'lib/active_workflow.rb', line 80

def signal!(execution_id, name, payload: nil)
  with_instrumentation("signal", execution_id, name) do
    store.signal!(execution_id, name.to_s, payload: payload)
  end
end

.storeActiveWorkflow::Stores::Base

Delegates the store accessor for convenience.



51
52
53
# File 'lib/active_workflow.rb', line 51

def store
  configuration.store!
end