Class: AWS::Flow::ActivityExecutionContext

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

Overview

The execution context for an activity task.

Instance Attribute Summary (collapse)

Instance Method Summary (collapse)

Constructor Details

- (ActivityExecutionContext) initialize(service, domain, task)

Initializes a new ActivityExecutionContext object.

Parameters:



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

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

Instance Attribute Details

- (Object) domain

Returns the value of attribute domain



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

def domain
  @domain
end

- (Object) service

Returns the value of attribute service



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

def service
  @service
end

- (Object) task

Returns the value of attribute task



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

def task
  @task
end

Instance Method Details

- (Object) record_activity_heartbeat(details)

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:

  • (CancellationException)

    The activity task has been cancelled.



146
147
148
149
150
151
152
# File 'aws-flow-ruby/aws-flow/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

- (String) task_token

Gets the task token, an opaque string that can be used to uniquely identify this task execution.

Returns:

  • (String)

    the activity task token.



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

def task_token
  @task.task_token
end

- (AWS::SimpleWorkflow::WorkflowExecution) workflow_execution

Gets the AWS::SimpleWorkflow::WorkflowExecution instance that is the context for this activity execution.

Returns:

  • (AWS::SimpleWorkflow::WorkflowExecution)

    The WorkflowExecution in this activity execution context.



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

def workflow_execution
  @task.workflow_execution
end