Menu
AWS Step Functions
API Reference (API Version 2016-11-23)

GetActivityTask

Used by workers to retrieve a task (with the specified activity ARN) which has been scheduled for execution by a running state machine. This initiates a long poll, where the service holds the HTTP connection open and responds as soon as a task becomes available (i.e. an execution of a task of this type is needed.) The maximum time the service holds on to the request before responding is 60 seconds. If no task is available within 60 seconds, the poll returns a taskToken with a null string.

Important

Workers should set their client side socket timeout to at least 65 seconds (5 seconds higher than the maximum time the service may hold the poll request).

Request Syntax

{
   "activityArn": "string",
   "workerName": "string"
}

Request Parameters

For information about the parameters that are common to all actions, see Common Parameters.

The request accepts the following data in JSON format.

activityArn

The Amazon Resource Name (ARN) of the activity to retrieve tasks from (assigned when you create the task using CreateActivity.)

Type: String

Length Constraints: Minimum length of 1. Maximum length of 256.

Required: Yes

workerName

You can provide an arbitrary name in order to identify the worker that the task is assigned to. This name is used when it is logged in the execution history.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 80.

Required: No

Response Syntax

{
   "input": "string",
   "taskToken": "string"
}

Response Elements

If the action is successful, the service sends back an HTTP 200 response.

The following data is returned in JSON format by the service.

input

The string that contains the JSON input data for the task.

Type: String

Length Constraints: Maximum length of 32768.

taskToken

A token that identifies the scheduled task. This token must be copied and included in subsequent calls to SendTaskHeartbeat, SendTaskSuccess or SendTaskFailure in order to report the progress or completion of the task.

Type: String

Length Constraints: Minimum length of 1. Maximum length of 1024.

Errors

For information about the errors that are common to all actions, see Common Errors.

ActivityDoesNotExist

The specified activity does not exist.

HTTP Status Code: 400

ActivityWorkerLimitExceeded

The maximum number of workers concurrently polling for activity tasks has been reached.

HTTP Status Code: 400

InvalidArn

The provided Amazon Resource Name (ARN) is invalid.

HTTP Status Code: 400

See Also

For more information about using this API in one of the language-specific AWS SDKs, see the following: