Class: AWS::Flow::ActivityExecutionContext

Inherits:
Object
  • Object
show all
Defined in:
lib/aws/decider/activity_definition.rb

Overview

The execution context for an activity task.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service, domain, task) ⇒ ActivityExecutionContext

Initializes a new ‘ActivityExecutionContext` object.

Parameters:



112
113
114
115
116
# File 'lib/aws/decider/activity_definition.rb', line 112

def initialize(service, domain, task)
  @service = service
  @domain = domain
  @task = task
end

Instance Attribute Details

#domainObject

Returns the value of attribute domain.



95
96
97
# File 'lib/aws/decider/activity_definition.rb', line 95

def domain
  @domain
end

#serviceObject

Returns the value of attribute service.



95
96
97
# File 'lib/aws/decider/activity_definition.rb', line 95

def service
  @service
end

#taskObject

Returns the value of attribute task.



95
96
97
# File 'lib/aws/decider/activity_definition.rb', line 95

def task
  @task
end

Instance Method Details

#record_activity_heartbeat(details) ⇒ Object

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

Parameters:

  • details (String)

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

Raises:



146
147
148
149
150
151
152
# 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_tokenString

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.

Returns:

  • (String)

    the activity task token.



122
123
124
# File 'lib/aws/decider/activity_definition.rb', line 122

def task_token
  @task.task_token
end

#workflow_executionAWS::SimpleWorkflow::WorkflowExecution

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

Returns:

  • (AWS::SimpleWorkflow::WorkflowExecution)

    The ‘WorkflowExecution` in this activity execution context.



133
134
135
# File 'lib/aws/decider/activity_definition.rb', line 133

def workflow_execution
  @task.workflow_execution
end