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:



107
108
109
110
111
# File 'lib/aws/decider/activity_definition.rb', line 107

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

Instance Attribute Details

#domainObject

Returns the value of attribute domain.



90
91
92
# File 'lib/aws/decider/activity_definition.rb', line 90

def domain
  @domain
end

#serviceObject

Returns the value of attribute service.



90
91
92
# File 'lib/aws/decider/activity_definition.rb', line 90

def service
  @service
end

#taskObject

Returns the value of attribute task.



90
91
92
# File 'lib/aws/decider/activity_definition.rb', line 90

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:



141
142
143
144
145
146
147
# File 'lib/aws/decider/activity_definition.rb', line 141

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.



117
118
119
# File 'lib/aws/decider/activity_definition.rb', line 117

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.



128
129
130
# File 'lib/aws/decider/activity_definition.rb', line 128

def workflow_execution
  @task.workflow_execution
end