class AWS::Flow::ActivityExecutionContext

The execution context for an activity task.

Attributes

domain[RW]
service[RW]
task[RW]

Public Class Methods

new(service, domain, task) click to toggle source

Initializes a new ‘ActivityExecutionContext` object.

@param [AWS::SimpleWorkflow] service

An instance of [AWS::SimpleWorkflow](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow.html) to
set for the activity execution context.

@param [AWS::SimpleWorkflow::Domain] domain

The [AWS::SimpleWorkflow::Domain](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/Domain.html)
in which the activity task is running.

@param [AWS::SimpleWorkflow::ActivityTask] task

The
[AWS::SimpleWorkflow::ActivityTask](http://docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/ActivityTask.html)
that this execution context is for.
# File lib/aws/decider/activity_definition.rb, line 112
def initialize(service, domain, task)
  @service = service
  @domain = domain
  @task = task
end

Public Instance Methods

record_activity_heartbeat(details) click to toggle source

Records a heartbeat for the activity, indicating to Amazon SWF that the activity is still making progress.

@param [String] details

If specified, contains details about the progress of the activity task. Up to 2048
characters can be provided.

@raise [CancellationException]

The activity task has been cancelled.
# File lib/aws/decider/activity_definition.rb, line 146
def record_activity_heartbeat(details)
  to_send = {:task_token => task_token.to_s, :details => details.to_s }
  response = @service.record_activity_task_heartbeat(to_send)
  # TODO See if cancel requested, throw exception if so
  raise CancellationException if response["cancelRequested"]

end
task_token() click to toggle source

Gets the [task token](docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/ActivityTask.html#task_token-instance_method), an opaque string that can be used to uniquely identify this task execution. @return [String] the activity task token.

# File lib/aws/decider/activity_definition.rb, line 122
def task_token
  @task.task_token
end
workflow_execution() click to toggle source

Gets the [AWS::SimpleWorkflow::WorkflowExecution](docs.aws.amazon.com/AWSRubySDK/latest/AWS/SimpleWorkflow/WorkflowExecution.html) instance that is the context for this activity execution.

@return [AWS::SimpleWorkflow::WorkflowExecution]

The `WorkflowExecution` in this activity execution context.
# File lib/aws/decider/activity_definition.rb, line 133
def workflow_execution
  @task.workflow_execution
end