class AWS::SimpleWorkflow::WorkflowType

Registering a WorkflowType

To register a workflow type you should use the workflow_types method on the domain:

domain.workflow_types.register('name', 'version', { ... })

See {AWS::SimpleWorkflow::WorkflowTypeCollection#register} for a complete list of options.

Deprecating a workflwo type

WorkflowType inherits from the generic {Type} base class. Defined in {Type} are a few useful methods including:

You can use these to deprecate a workflow type:

domain.workflow_types['name','version'].deprecate

@attr_reader [Time] creation_date When the workflow type was registered.

@attr_reader [Time,nil] deprecation_date When the workflow type

was deprecated, or nil if the workflow type has not been deprecated.

@attr_reader [String,nil] description The description of this workflow

type, or nil if was not set when it was registered.

@attr_reader [Symbol] status The status of this workflow type. The

status will either be +:registered+ or +:deprecated+.

@attr_reader [Symbol,nil] default_child_policy Specifies the default

policy to use for the child workflow executions when a workflow 
execution of this type is terminated.  Values may be one of the
following (or nil):

* +:terminate+ - the child executions will be terminated.

* +:request_cancel+ - a request to cancel will be attempted for each
  child execution by recording a WorkflowExecutionCancelRequested 
  event in its history. It is up to the decider to take appropriate
  actions when it receives an execution history with this event.

* +:abandon+ - no action will be taken. The child executions will 
  continue to run.

@attr_reader [Integer,:none,nil] default_execution_start_to_close_timeout

The default maximum duration for executions of this workflow type.

The return value may be an integer (number of seconds), the
symbol +:none+ (implying no timeout) or +nil+ (not specified).

@attr_reader [String,nil] default_task_list Specifies

the default task list to use for scheduling decision tasks for 
executions of this workflow type.

@attr_reader [Integer,:none,nil] default_task_start_to_close_timeout

The default maximum duration of decision tasks for this workflow type.

The return value may be an integer (number of seconds), the
symbol +:none+ (implying no timeout) or +nil+ (not specified).

Public Instance Methods

count_executions(options = {}) click to toggle source

Returns a count of workflow executions of this workflow type.

domain.workflow_types['name','version'].count

@note (see AWS::SimpleWorkflow::WorkflowExecution#count_executions) @param (see AWS::SimpleWorkflow::WorkflowExecution#count_executions) @option (see AWS::SimpleWorkflow::WorkflowExecution#count_executions) @return [Integer] Returns the count of workflow execution of this type.

# File lib/aws/simple_workflow/workflow_type.rb, line 143
def count_executions options = {}
  options[:workflow_type] = self
  domain.workflow_executions.count(options)
end
start_execution(options = {}) click to toggle source

@param [Hash] options

@option (see AWS::SimpleWorkflow::DecisionTask#continue_as_new_workflow_execution)

@option options [String] :workflow_id

A user defined identifier associated with the workflow execution.
You can use this to associate a custom identifier with the 
workflow execution. You may specify the same identifier if a 
workflow execution is logically a restart of a previous execution. 
You cannot have two open workflow executions with the same 
:workflow_id at the same time.

If you do not provide +:workflow_id+ a random UUID will be generated.

@return [WorkflowExecution] Returns the new workflow execution.

# File lib/aws/simple_workflow/workflow_type.rb, line 122
def start_execution options = {}
  
  options[:domain] = domain.name
  start_execution_opts(options, self)
  response = client.start_workflow_execution(options)

  workflow_id = options[:workflow_id]
  run_id = response.data['runId']

  domain.workflow_executions[workflow_id, run_id]

end
workflow_executions() click to toggle source

@return [WorkflowExecutionCollection] Returns a collection that

enumerates only workflow executions of this type.
# File lib/aws/simple_workflow/workflow_type.rb, line 150
def workflow_executions
  WorkflowExecutionCollection.new(domain).with_workflow_type(self)
end