Class: SimplerWorkflow::Workflow::ActivityTaskFailedHandler

Inherits:
DefaultEventHandler show all
Defined in:
lib/simpler_workflow/workflow.rb

Instance Attribute Summary

Attributes inherited from DefaultEventHandler

#workflow

Instance Method Summary collapse

Methods inherited from DefaultEventHandler

#domain, #initial_activity_type, #initialize, #last_activity, #last_input, #scheduled_event

Constructor Details

This class inherits a constructor from SimplerWorkflow::Workflow::DefaultEventHandler

Instance Method Details

#call(decision_task, event) ⇒ Object



204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
# File 'lib/simpler_workflow/workflow.rb', line 204

def call(decision_task, event)
  last_activity_type = last_activity(decision_task, event)
  failed_activity = domain.activities[last_activity_type]

  case failed_activity.failure_policy
  when :abort, :cancel
    SimplerWorkflow.logger.info("Cancelling workflow execution.")
    decision_task.cancel_workflow_execution
  when :retry
    SimplerWorkflow.logger.info("Retrying activity #{last_activity_type.name} #{last_activity_type.version}")
    decision_task.schedule_activity_task last_activity_type, :input => last_input(decision_task, event)
  else
    SimplerWorkflow.logger.info("Failing the workflow execution.")
    decision_task.fail_workflow_execution
  end
end