Class: SimplerWorkflow::Workflow::ActivityTaskCompletedHandler

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



223
224
225
226
227
228
229
230
231
232
233
234
# File 'lib/simpler_workflow/workflow.rb', line 223

def call(decision_task, event)
  last_activity_type = last_activity(decision_task, event)

  completed_activity = domain.activities[last_activity_type]

  if next_activity = completed_activity.next_activity
    activity_type = domain.activity_types[next_activity.name, next_activity.version]
    decision_task.schedule_activity_task activity_type, input: scheduled_event(decision_task, event).attributes.input
  else
    decision_task.complete_workflow_execution(result: 'success')
  end
end