Class: ActiveSaga::Jobs::RunnerJob

Inherits:
ActiveJob::Base
  • Object
show all
Defined in:
lib/active_saga/jobs/runner_job.rb

Overview

Executes workflow transitions within Active Job.

Instance Method Summary collapse

Instance Method Details

#perform(execution_id) ⇒ Object



12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/active_saga/jobs/runner_job.rb', line 12

def perform(execution_id)
  execution = ActiveSaga.configuration.store.load_execution(execution_id)
  if execution
    workflow = execution.workflow_class || "UnknownWorkflow"
    step = execution.cursor_step || "pending"
    ActiveSaga.configuration.logger.info(
      "ActiveSaga::RunnerJob executing #{workflow}##{step} (execution=#{execution_id}) (state=#{execution.state})"
    )
  end

  ActiveSaga.configuration.store!.process_execution(execution_id)
rescue ActiveSaga::Errors::InvalidWorkflow => e
  ActiveSaga.configuration.logger.error("ActiveSaga invalid workflow: #{e.message}")
  raise
end