tasks.TaskContext interface Stay organized with collections Save and categorize content based on your preferences.
Metadata about a call to a Task Queue function.
Signature:
exportinterfaceTaskContextProperties
| Property | Type | Description |
|---|---|---|
| auth | AuthData | The result of decoding and verifying an ODIC token. |
| executionCount | number | The total number of times that the task has received a response from the handler. Since Cloud Tasks deletes the task once a successful response has been received, all previous handler responses were failures. This number does not include failures due to 5XX error codes. Populated via theX-CloudTasks-TaskExecutionCount header. |
| headers | Record<string, string> | Raw request headers. |
| id | string | The "short" name of the task, or, if no name was specified at creation, a unique system-generated id. This is the "my-task-id" value in the complete task name, such as "task_name = projects/my-project-id/locations/my-location/queues/my-queue-id/tasks/my-task-id." Populated via theX-CloudTasks-TaskName header. |
| previousResponse | number | The HTTP response code from the previous retry. Populated via theX-CloudTasks-TaskPreviousResponse header |
| queueName | string | The name of the queue. Populated via theX-CloudTasks-QueueName header. |
| retryCount | number | The number of times this task has been retried. For the first attempt, this value is 0. This number includes attempts where the task failed due to 5XX error codes and never reached the execution phase. Populated via theX-CloudTasks-TaskRetryCount header. |
| retryReason | string | The reason for retrying the task. Populated via theX-CloudTasks-TaskRetryReason header. |
| scheduledTime | string | The schedule time of the task, as an RFC 3339 string in UTC time zone. Populated via theX-CloudTasks-TaskETA header, which uses seconds since January 1 1970. |
tasks.TaskContext.auth
The result of decoding and verifying an ODIC token.
Signature:
auth?:AuthData;tasks.TaskContext.executionCount
The total number of times that the task has received a response from the handler. Since Cloud Tasks deletes the task once a successful response has been received, all previous handler responses were failures. This number does not include failures due to 5XX error codes. Populated via theX-CloudTasks-TaskExecutionCount header.
Signature:
executionCount:number;tasks.TaskContext.headers
Raw request headers.
Signature:
headers?:Record<string,string>;tasks.TaskContext.id
The "short" name of the task, or, if no name was specified at creation, a unique system-generated id. This is the "my-task-id" value in the complete task name, such as "task_name = projects/my-project-id/locations/my-location/queues/my-queue-id/tasks/my-task-id." Populated via theX-CloudTasks-TaskName header.
Signature:
id:string;tasks.TaskContext.previousResponse
The HTTP response code from the previous retry. Populated via theX-CloudTasks-TaskPreviousResponse header
Signature:
previousResponse?:number;tasks.TaskContext.queueName
The name of the queue. Populated via theX-CloudTasks-QueueName header.
Signature:
queueName:string;tasks.TaskContext.retryCount
The number of times this task has been retried. For the first attempt, this value is 0. This number includes attempts where the task failed due to 5XX error codes and never reached the execution phase. Populated via theX-CloudTasks-TaskRetryCount header.
Signature:
retryCount:number;tasks.TaskContext.retryReason
The reason for retrying the task. Populated via theX-CloudTasks-TaskRetryReason header.
Signature:
retryReason?:string;tasks.TaskContext.scheduledTime
The schedule time of the task, as an RFC 3339 string in UTC time zone. Populated via theX-CloudTasks-TaskETA header, which uses seconds since January 1 1970.
Signature:
scheduledTime:string;Except as otherwise noted, the content of this page is licensed under theCreative Commons Attribution 4.0 License, and code samples are licensed under theApache 2.0 License. For details, see theGoogle Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2023-11-21 UTC.