Module: Temporal::Workflow::Command

Defined in:
lib/temporal/workflow/command.rb

Defined Under Namespace

Classes: CancelTimer, CompleteWorkflow, ContinueAsNew, FailWorkflow, RecordMarker, RequestActivityCancellation, ScheduleActivity, StartChildWorkflow, StartTimer

Constant Summary collapse

SCHEDULE_ACTIVITY_TYPE =

only these commands are supported right now

:schedule_activity
START_CHILD_WORKFLOW_TYPE =
:start_child_workflow
CONTINUE_AS_NEW =
:continue_as_new
RECORD_MARKER_TYPE =
:record_marker
START_TIMER_TYPE =
:start_timer
CANCEL_TIMER_TYPE =
:cancel_timer
COMPLETE_WORKFLOW_TYPE =
:complete_workflow
FAIL_WORKFLOW_TYPE =
:fail_workflow
COMMAND_CLASS_MAP =
{
  SCHEDULE_ACTIVITY_TYPE => ScheduleActivity,
  START_CHILD_WORKFLOW_TYPE => StartChildWorkflow,
  CONTINUE_AS_NEW => ContinueAsNew,
  RECORD_MARKER_TYPE => RecordMarker,
  START_TIMER_TYPE => StartTimer,
  CANCEL_TIMER_TYPE => CancelTimer,
  COMPLETE_WORKFLOW_TYPE => CompleteWorkflow,
  FAIL_WORKFLOW_TYPE => FailWorkflow
}.freeze

Class Method Summary collapse

Class Method Details

.generate(type, **args) ⇒ Object



36
37
38
39
# File 'lib/temporal/workflow/command.rb', line 36

def self.generate(type, **args)
  command_class = COMMAND_CLASS_MAP[type]
  command_class.new(**args)
end