| « PreviousNext » | |
![]() ![]() | Did this page help you? Yes | No | Tell us about it... |
Used by deciders to get a DecisionTask from the specified decision taskList.
A decision task may be returned for any open workflow execution that is
using the specified task list. The task includes a paginated view of the history of the workflow execution.
The decider should use the workflow type and the history to determine how to properly handle the task.
This action initiates a long poll, where the service holds the HTTP connection open and responds as soon a task becomes available. If no decision task is available in the specified task list before the timeout of 60 seconds expires, an empty result is returned. An empty result, in this context, means that a DecisionTask is returned, but that the value of taskToken is an empty string.
Important
Deciders should set their client side socket timeout to at least 70 seconds (10 seconds higher than the timeout).
Important
Because the number of workflow history events for a single workflow execution might be very large, the result
returned might be split up across a number of pages.
To retrieve subsequent pages, make additional calls to PollForDecisionTask using the nextPageToken returned by the initial call.
Note that you do not call GetWorkflowExecutionHistory with this nextPageToken. Instead, call PollForDecisionTask again.
Access Control
You can use IAM policies to control this action's access to Amazon SWF resources as follows:
Resource element with the domain name to limit the action to only specified domains.Action element to allow or deny permission to call this action.taskList.name parameter by using a Condition element with the swf:taskList.name key to allow the action to access only certain task lists.If the caller does not have sufficient permissions to invoke the action, or the parameter values fall outside the specified constraints, the action fails by throwing OperationNotPermitted. For details and example IAM policies,
see Using IAM to Manage Access to Amazon SWF Workflows.
{
"domain": "string",
"identity": "string",
"maximumPageSize": "number",
"nextPageToken": "string",
"reverseOrder": "boolean",
"taskList": {
"name": "string"
}
}
For information about the common parameters that all actions use, see Common Parameters.
The request accepts the following data in JSON format.
The name of the domain containing the task lists to poll.
Type: String
Length constraints: Minimum length of 1. Maximum length of 256.
Required: Yes
Identity of the decider making the request, which is recorded in the DecisionTaskStarted event in the workflow history. This enables diagnostic tracing when problems arise. The form of this identity is user defined.
Type: String
Length constraints: Minimum length of 0. Maximum length of 256.
Required: No
The maximum number of history events returned in each page. The default is 100, but the caller can override this value to a page size smaller than the default. You cannot specify a page size greater than 100. Note that the number of events may be less than the maxiumum page size, in which case, the returned page will have fewer results than the maximumPageSize specified.
Type: Number
Required: No
If on a previous call to this method a NextPageToken was returned, the results are
being paginated. To get the next page of results, repeat the call with the returned token and
all other arguments unchanged.
Note
The nextPageToken returned by this action cannot be used with
GetWorkflowExecutionHistory to get the next page. You must call PollForDecisionTask again
(with the nextPageToken) to retrieve the next page of history records. Calling PollForDecisionTask
with a nextPageToken will not return a new decision task.
.
Type: String
Length constraints: Minimum length of 0. Maximum length of 2048.
Required: No
When set to true, returns the events in reverse order. By default the results are returned in ascending order
of the eventTimestamp of the events.
Type: Boolean
Required: No
Specifies the task list to poll for decision tasks.
The specified string must not start or end with whitespace. It must not contain a : (colon), / (slash), | (vertical bar), or any control characters (\u0000-\u001f | \u007f - \u009f). Also, it must not contain the literal string "arn".
Type: TaskList object
Required: Yes
{
"events": [
{
"activityTaskCancelRequestedEventAttributes": {
"activityId": "string",
"decisionTaskCompletedEventId": "number"
},
"activityTaskCanceledEventAttributes": {
"details": "string",
"latestCancelRequestedEventId": "number",
"scheduledEventId": "number",
"startedEventId": "number"
},
"activityTaskCompletedEventAttributes": {
"result": "string",
"scheduledEventId": "number",
"startedEventId": "number"
},
"activityTaskFailedEventAttributes": {
"details": "string",
"reason": "string",
"scheduledEventId": "number",
"startedEventId": "number"
},
"activityTaskScheduledEventAttributes": {
"activityId": "string",
"activityType": {
"name": "string",
"version": "string"
},
"control": "string",
"decisionTaskCompletedEventId": "number",
"heartbeatTimeout": "string",
"input": "string",
"scheduleToCloseTimeout": "string",
"scheduleToStartTimeout": "string",
"startToCloseTimeout": "string",
"taskList": {
"name": "string"
}
},
"activityTaskStartedEventAttributes": {
"identity": "string",
"scheduledEventId": "number"
},
"activityTaskTimedOutEventAttributes": {
"details": "string",
"scheduledEventId": "number",
"startedEventId": "number",
"timeoutType": "string"
},
"cancelTimerFailedEventAttributes": {
"cause": "string",
"decisionTaskCompletedEventId": "number",
"timerId": "string"
},
"cancelWorkflowExecutionFailedEventAttributes": {
"cause": "string",
"decisionTaskCompletedEventId": "number"
},
"childWorkflowExecutionCanceledEventAttributes": {
"details": "string",
"initiatedEventId": "number",
"startedEventId": "number",
"workflowExecution": {
"runId": "string",
"workflowId": "string"
},
"workflowType": {
"name": "string",
"version": "string"
}
},
"childWorkflowExecutionCompletedEventAttributes": {
"initiatedEventId": "number",
"result": "string",
"startedEventId": "number",
"workflowExecution": {
"runId": "string",
"workflowId": "string"
},
"workflowType": {
"name": "string",
"version": "string"
}
},
"childWorkflowExecutionFailedEventAttributes": {
"details": "string",
"initiatedEventId": "number",
"reason": "string",
"startedEventId": "number",
"workflowExecution": {
"runId": "string",
"workflowId": "string"
},
"workflowType": {
"name": "string",
"version": "string"
}
},
"childWorkflowExecutionStartedEventAttributes": {
"initiatedEventId": "number",
"workflowExecution": {
"runId": "string",
"workflowId": "string"
},
"workflowType": {
"name": "string",
"version": "string"
}
},
"childWorkflowExecutionTerminatedEventAttributes": {
"initiatedEventId": "number",
"startedEventId": "number",
"workflowExecution": {
"runId": "string",
"workflowId": "string"
},
"workflowType": {
"name": "string",
"version": "string"
}
},
"childWorkflowExecutionTimedOutEventAttributes": {
"initiatedEventId": "number",
"startedEventId": "number",
"timeoutType": "string",
"workflowExecution": {
"runId": "string",
"workflowId": "string"
},
"workflowType": {
"name": "string",
"version": "string"
}
},
"completeWorkflowExecutionFailedEventAttributes": {
"cause": "string",
"decisionTaskCompletedEventId": "number"
},
"continueAsNewWorkflowExecutionFailedEventAttributes": {
"cause": "string",
"decisionTaskCompletedEventId": "number"
},
"decisionTaskCompletedEventAttributes": {
"executionContext": "string",
"scheduledEventId": "number",
"startedEventId": "number"
},
"decisionTaskScheduledEventAttributes": {
"startToCloseTimeout": "string",
"taskList": {
"name": "string"
}
},
"decisionTaskStartedEventAttributes": {
"identity": "string",
"scheduledEventId": "number"
},
"decisionTaskTimedOutEventAttributes": {
"scheduledEventId": "number",
"startedEventId": "number",
"timeoutType": "string"
},
"eventId": "number",
"eventTimestamp": "number",
"eventType": "string",
"externalWorkflowExecutionCancelRequestedEventAttributes": {
"initiatedEventId": "number",
"workflowExecution": {
"runId": "string",
"workflowId": "string"
}
},
"externalWorkflowExecutionSignaledEventAttributes": {
"initiatedEventId": "number",
"workflowExecution": {
"runId": "string",
"workflowId": "string"
}
},
"failWorkflowExecutionFailedEventAttributes": {
"cause": "string",
"decisionTaskCompletedEventId": "number"
},
"markerRecordedEventAttributes": {
"decisionTaskCompletedEventId": "number",
"details": "string",
"markerName": "string"
},
"recordMarkerFailedEventAttributes": {
"cause": "string",
"decisionTaskCompletedEventId": "number",
"markerName": "string"
},
"requestCancelActivityTaskFailedEventAttributes": {
"activityId": "string",
"cause": "string",
"decisionTaskCompletedEventId": "number"
},
"requestCancelExternalWorkflowExecutionFailedEventAttributes": {
"cause": "string",
"control": "string",
"decisionTaskCompletedEventId": "number",
"initiatedEventId": "number",
"runId": "string",
"workflowId": "string"
},
"requestCancelExternalWorkflowExecutionInitiatedEventAttributes": {
"control": "string",
"decisionTaskCompletedEventId": "number",
"runId": "string",
"workflowId": "string"
},
"scheduleActivityTaskFailedEventAttributes": {
"activityId": "string",
"activityType": {
"name": "string",
"version": "string"
},
"cause": "string",
"decisionTaskCompletedEventId": "number"
},
"signalExternalWorkflowExecutionFailedEventAttributes": {
"cause": "string",
"control": "string",
"decisionTaskCompletedEventId": "number",
"initiatedEventId": "number",
"runId": "string",
"workflowId": "string"
},
"signalExternalWorkflowExecutionInitiatedEventAttributes": {
"control": "string",
"decisionTaskCompletedEventId": "number",
"input": "string",
"runId": "string",
"signalName": "string",
"workflowId": "string"
},
"startChildWorkflowExecutionFailedEventAttributes": {
"cause": "string",
"control": "string",
"decisionTaskCompletedEventId": "number",
"initiatedEventId": "number",
"workflowId": "string",
"workflowType": {
"name": "string",
"version": "string"
}
},
"startChildWorkflowExecutionInitiatedEventAttributes": {
"childPolicy": "string",
"control": "string",
"decisionTaskCompletedEventId": "number",
"executionStartToCloseTimeout": "string",
"input": "string",
"tagList": [
"string"
],
"taskList": {
"name": "string"
},
"taskStartToCloseTimeout": "string",
"workflowId": "string",
"workflowType": {
"name": "string",
"version": "string"
}
},
"startTimerFailedEventAttributes": {
"cause": "string",
"decisionTaskCompletedEventId": "number",
"timerId": "string"
},
"timerCanceledEventAttributes": {
"decisionTaskCompletedEventId": "number",
"startedEventId": "number",
"timerId": "string"
},
"timerFiredEventAttributes": {
"startedEventId": "number",
"timerId": "string"
},
"timerStartedEventAttributes": {
"control": "string",
"decisionTaskCompletedEventId": "number",
"startToFireTimeout": "string",
"timerId": "string"
},
"workflowExecutionCancelRequestedEventAttributes": {
"cause": "string",
"externalInitiatedEventId": "number",
"externalWorkflowExecution": {
"runId": "string",
"workflowId": "string"
}
},
"workflowExecutionCanceledEventAttributes": {
"decisionTaskCompletedEventId": "number",
"details": "string"
},
"workflowExecutionCompletedEventAttributes": {
"decisionTaskCompletedEventId": "number",
"result": "string"
},
"workflowExecutionContinuedAsNewEventAttributes": {
"childPolicy": "string",
"decisionTaskCompletedEventId": "number",
"executionStartToCloseTimeout": "string",
"input": "string",
"newExecutionRunId": "string",
"tagList": [
"string"
],
"taskList": {
"name": "string"
},
"taskStartToCloseTimeout": "string",
"workflowType": {
"name": "string",
"version": "string"
}
},
"workflowExecutionFailedEventAttributes": {
"decisionTaskCompletedEventId": "number",
"details": "string",
"reason": "string"
},
"workflowExecutionSignaledEventAttributes": {
"externalInitiatedEventId": "number",
"externalWorkflowExecution": {
"runId": "string",
"workflowId": "string"
},
"input": "string",
"signalName": "string"
},
"workflowExecutionStartedEventAttributes": {
"childPolicy": "string",
"continuedExecutionRunId": "string",
"executionStartToCloseTimeout": "string",
"input": "string",
"parentInitiatedEventId": "number",
"parentWorkflowExecution": {
"runId": "string",
"workflowId": "string"
},
"tagList": [
"string"
],
"taskList": {
"name": "string"
},
"taskStartToCloseTimeout": "string",
"workflowType": {
"name": "string",
"version": "string"
}
},
"workflowExecutionTerminatedEventAttributes": {
"cause": "string",
"childPolicy": "string",
"details": "string",
"reason": "string"
},
"workflowExecutionTimedOutEventAttributes": {
"childPolicy": "string",
"timeoutType": "string"
}
}
],
"nextPageToken": "string",
"previousStartedEventId": "number",
"startedEventId": "number",
"taskToken": "string",
"workflowExecution": {
"runId": "string",
"workflowId": "string"
},
"workflowType": {
"name": "string",
"version": "string"
}
}
The following data is returned in JSON format by the service.
A paginated list of history events of the workflow execution. The decider uses this during the processing of the decision task.
Type: array of HistoryEvent objects
Required: Yes
Returns a value if the results are paginated. To get the next page of results, repeat the request specifying this token and all other arguments unchanged.
Type: String
Length constraints: Minimum length of 0. Maximum length of 2048.
Required: No
The id of the DecisionTaskStarted event of the previous decision task of this workflow execution that was processed by the decider. This can be used to determine the events in the history new since the last decision task received by the decider.
Type: Long
Required: No
The id of the DecisionTaskStarted event recorded in the history.
Type: Long
Required: Yes
The opaque string used as a handle on the task. This token is used by workers to communicate progress and response information back to the system about the task.
Type: String
Length constraints: Minimum length of 1. Maximum length of 1024.
Required: Yes
The workflow execution for which this decision task was created.
Type: WorkflowExecution object
Required: Yes
The type of the workflow execution for which this decision task was created.
Type: WorkflowType object
Required: Yes
For information about the errors that are common to all actions, see Common Errors.
Returned by any operation if a system imposed limitation has been reached. To address this fault you should either clean up unused resources or increase the limit by contacting AWS.
HTTP Status Code: 400
Returned when the caller does not have sufficient permissions to invoke the action.
HTTP Status Code: 400
Returned when the named resource cannot be found with in the scope of this operation (region or domain). This could happen if the named resource was never created or is no longer available for this operation.
HTTP Status Code: 400
POST / HTTP/1.1
Host: swf.us-east-1.amazonaws.com
User-Agent: Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.2.25) Gecko/20111212 Firefox/3.6.25 ( .NET CLR 3.5.30729; .NET4.0E)
Accept: application/json, text/javascript, */*
Accept-Language: en-us,en;q=0.5
Accept-Encoding: gzip,deflate
Accept-Charset: ISO-8859-1,utf-8;q=0.7,*;q=0.7
Keep-Alive: 115
Connection: keep-alive
Content-Type: application/x-amz-json-1.0
X-Requested-With: XMLHttpRequest
X-Amz-Date: Sun, 15 Jan 2012 02:09:54 GMT
X-Amz-Target: SimpleWorkflowService.PollForDecisionTask
Content-Encoding: amz-1.0
X-Amzn-Authorization: AWS3 AWSAccessKeyId=AKIAIOSFODNN7EXAMPLE,Algorithm=HmacSHA256,SignedHeaders=Host;X-Amz-Date;X-Amz-Target;Content-Encoding,Signature=R3CJ2HMLSVpc2p6eafeztZCZWcgza+h61gSUuWx15gw=
Referer: http://swf.us-east-1.amazonaws.com/explorer/index.html
Content-Length: 171
Pragma: no-cache
Cache-Control: no-cache
{"domain": "867530901",
"taskList":
{"name": "specialTaskList"},
"identity": "Decider01",
"maximumPageSize": 50,
"reverseOrder": true}
HTTP/1.1 200 OK
Content-Length: 1639
Content-Type: application/json
x-amzn-RequestId: 03db54cf-3f1e-11e1-b118-3bfa5e8e7fc3
{"events":
[
{"decisionTaskStartedEventAttributes":
{"identity": "Decider01",
"scheduledEventId": 2},
"eventId": 3,
"eventTimestamp": 1326593394.566,
"eventType": "DecisionTaskStarted"},
{"decisionTaskScheduledEventAttributes":
{"startToCloseTimeout": "600",
"taskList":
{"name": "specialTaskList"}
},
"eventId": 2,
"eventTimestamp": 1326592619.474,
"eventType": "DecisionTaskScheduled"},
{"eventId": 1,
"eventTimestamp": 1326592619.474,
"eventType": "WorkflowExecutionStarted",
"workflowExecutionStartedEventAttributes":
{"childPolicy": "TERMINATE",
"executionStartToCloseTimeout": "3600",
"input": "arbitrary-string-that-is-meaningful-to-the-workflow",
"parentInitiatedEventId": 0,
"tagList":
["music purchase", "digital", "ricoh-the-dog"],
"taskList":
{"name": "specialTaskList"},
"taskStartToCloseTimeout": "600",
"workflowType":
{"name": "customerOrderWorkflow",
"version": "1.0"}
}
}
],
"previousStartedEventId": 0,
"startedEventId": 3,
"taskToken": "AAAAKgAAAAEAAAAAAAAAATZDvCYwk/hP/X1ZGdJhb+T6OWzcBx2DPhsIi5HF4aGQI4OXrDE7Ny3uM+aiAhGrmeNyVAa4yNIBQuoZuJA5G+BoaB0JuHFBOynHDTnm7ayNH43KhMkfdrDG4elfHSz3m/EtbLnFGueAr7+3NKDG6x4sTKg3cZpOtSguSx05yI1X3AtscS8ATcLB2Y3Aub1YonN/i/k67voca/GFsSiwSz3AAnJj1IPvrujgIj9KUvckwRPC5ET7d33XJcRp+gHYzZsBLVBaRmV3gEYAnp2ICslFn4YSjGy+dFXCNpOa4G1O8pczCbFUGbQ3+5wf0RSaa/xMq2pfdBKnuFp0wp8kw1k+5ZsbtDZeZn8g5GyKCLiLms/xD0OxugGGUe5ZlAoHEkTWGxZj/G32P7cMoCgrcACfFPdx1LNYYEre7YiGiyjGnfW2t5mW7VK9Np28vcXVbdpH4JNEB9OuB1xqL8N8ifPVtc72uxB1i9XEdq/8rkXasSEw4TubB2FwgqnuJstmfEhpOdb5HfhR6OwmnHuk9eszO/fUkGucTUXQP2hhB+Gz",
"workflowExecution":
{"runId": "06b8f87a-24b3-40b6-9ceb-9676f28e9493",
"workflowId": "20110927-T-1"},
"workflowType":
{"name": "customerOrderWorkflow",
"version": "1.0"}
}