Go 1.11 has reached end of support
and will be deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Go 1.11
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Go
1.11 applications will continue to run and receive traffic after their
deprecation date. We
recommend that you migrate to the latest supported version of Go.
var(//ErrTaskAlreadyAddedistheerrorreturnedbyAddandAddMultiwhenataskhasalreadybeenaddedwithaparticularname.ErrTaskAlreadyAdded=errors.New("taskqueue: task has already been added"))
DeleteMulti deletes multiple tasks from a named queue.
If a given task could not be deleted, an appengine.MultiError is returned.
Each task is deleted independently; one may fail to delete while the others
are successfully deleted.
ModifyLease modifies the lease of a task.
Used to request more processing time, or to abandon processing.
leaseTime is in seconds and must not be negative.
typeQueueStatisticsstruct{Tasksint// may be an approximationOldestETAtime.Time// zero if there are no pending tasksExecuted1Minuteint// tasks executed in the last minuteInFlightint// tasks executing nowEnforcedRatefloat64// requests per second}
QueueStatistics represents statistics about a single task queue.
ParseRequestHeaders parses the special HTTP request headers available to push
task request handlers. This function silently ignores values of the wrong
format.
RetryOptions
typeRetryOptionsstruct{// Number of tries/leases after which the task fails permanently and is deleted.// If AgeLimit is also set, both limits must be exceeded for the task to fail permanently.RetryLimitint32// Maximum time allowed since the task's first try before the task fails permanently and is deleted (only for push tasks).// If RetryLimit is also set, both limits must be exceeded for the task to fail permanently.AgeLimittime.Duration// Minimum time between successive tries (only for push tasks).MinBackofftime.Duration// Maximum time between successive tries (only for push tasks).MaxBackofftime.Duration// Maximum number of times to double the interval between successive tries before the intervals increase linearly (only for push tasks).MaxDoublingsint32// If MaxDoublings is zero, set ApplyZeroMaxDoublings to true to override the default non-zero value.// Otherwise a zero MaxDoublings is ignored and the default is used.ApplyZeroMaxDoublingsbool}
RetryOptions let you control whether to retry a task and the backoff intervals between tries.
Task
typeTaskstruct{// Path is the worker URL for the task.// If unset, it will default to /_ah/queue/
Add adds the task to a named queue.
An empty queue name means that the default queue will be used.
Add returns an equivalent Task with defaults filled in, including setting
the task's Name field to the chosen name if the original was empty.
AddMulti adds multiple tasks to a named queue.
An empty queue name means that the default queue will be used.
AddMulti returns a slice of equivalent tasks with defaults filled in, including setting
each task's Name field to the chosen name if the original was empty.
If a given task is badly formed or could not be added, an appengine.MultiError is returned.
LeaseByTag leases tasks from a queue, grouped by tag.
If tag is empty, then the returned tasks are grouped by the tag of the task with earliest ETA.
leaseTime is in seconds.
The number of tasks fetched will be at most maxTasks.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-07 UTC."],[[["\u003cp\u003eThis package provides a client for App Engine's task queue service, enabling applications to perform work outside of user requests.\u003c/p\u003e\n"],["\u003cp\u003eThe taskqueue service supports adding tasks, either individually via \u003ccode\u003eAdd\u003c/code\u003e or in bulk using \u003ccode\u003eAddMulti\u003c/code\u003e, to a specified or default queue.\u003c/p\u003e\n"],["\u003cp\u003eTasks can be managed by deleting them using \u003ccode\u003eDelete\u003c/code\u003e or \u003ccode\u003eDeleteMulti\u003c/code\u003e, modifying their lease with \u003ccode\u003eModifyLease\u003c/code\u003e, or purging entire queues with \u003ccode\u003ePurge\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eStatistics about task queues, such as the number of tasks and execution metrics, can be retrieved through \u003ccode\u003eQueueStats\u003c/code\u003e.\u003c/p\u003e\n"],["\u003cp\u003eThe package includes functionality for handling HTTP request headers specific to push tasks, including parsing them via \u003ccode\u003eParseRequestHeaders\u003c/code\u003e and controlling retry behavior using \u003ccode\u003eRetryOptions\u003c/code\u003e.\u003c/p\u003e\n"]]],[],null,["# Package google.golang.org/appengine/taskqueue (v1.6.8)\n\nVersion latestkeyboard_arrow_down\n\n- [1.6.8 (latest)](/appengine/docs/legacy/standard/go111/reference/latest/taskqueue)\n- [1.6.7](/appengine/docs/legacy/standard/go111/reference/1.6.7/taskqueue) \n**Note:** To get more information about this package, such as access to older versions, view [this package on pkg.go.dev](https://pkg.go.dev/google.golang.org/appengine/taskqueue). \n\u003cbr /\u003e\n\nPackage taskqueue provides a client for App Engine's taskqueue service.\nUsing this service, applications may perform work outside a user's request.\n\nA Task may be constructed manually; alternatively, since the most common\ntaskqueue operation is to add a single POST task, NewPOSTTask makes it easy. \n\n```maple\nt := taskqueue.NewPOSTTask(\"/worker\", url.Values{\n \"key\": {key},\n})\ntaskqueue.Add(c, t, \"\") // add t to the default queue\n``` \n\nVariables\n---------\n\n### ErrTaskAlreadyAdded\n\n var (\n \t// ErrTaskAlreadyAdded is the error returned by Add and AddMulti when a task has already been added with a particular name.\n \tErrTaskAlreadyAdded = https://pkg.go.dev/errors.https://pkg.go.dev/errors#New(\"taskqueue: task has already been added\")\n )\n\nFunctions\n---------\n\n### func Delete\n\n func Delete(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, task *#google_golang_org_appengine_taskqueue_Task, queueName https://pkg.go.dev/builtin#string) https://pkg.go.dev/builtin#error\n\nDelete deletes a task from a named queue. \n\n### func DeleteMulti\n\n func DeleteMulti(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, tasks []*#google_golang_org_appengine_taskqueue_Task, queueName https://pkg.go.dev/builtin#string) https://pkg.go.dev/builtin#error\n\nDeleteMulti deletes multiple tasks from a named queue.\nIf a given task could not be deleted, an appengine.MultiError is returned.\nEach task is deleted independently; one may fail to delete while the others\nare successfully deleted. \n\n### func ModifyLease\n\n func ModifyLease(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, task *#google_golang_org_appengine_taskqueue_Task, queueName https://pkg.go.dev/builtin#string, leaseTime https://pkg.go.dev/builtin#int) https://pkg.go.dev/builtin#error\n\nModifyLease modifies the lease of a task.\nUsed to request more processing time, or to abandon processing.\nleaseTime is in seconds and must not be negative. \n\n### func Purge\n\n func Purge(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, queueName https://pkg.go.dev/builtin#string) https://pkg.go.dev/builtin#error\n\nPurge removes all tasks from a queue. \n\nQueueStatistics\n---------------\n\n type QueueStatistics struct {\n \tTasks https://pkg.go.dev/builtin#int // may be an approximation\n \tOldestETA https://pkg.go.dev/time.https://pkg.go.dev/time#Time // zero if there are no pending tasks\n\n \tExecuted1Minute https://pkg.go.dev/builtin#int // tasks executed in the last minute\n \tInFlight https://pkg.go.dev/builtin#int // tasks executing now\n \tEnforcedRate https://pkg.go.dev/builtin#float64 // requests per second\n }\n\nQueueStatistics represents statistics about a single task queue. \n\n### func QueueStats\n\n func QueueStats(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, queueNames []https://pkg.go.dev/builtin#string) ([]#google_golang_org_appengine_taskqueue_QueueStatistics, https://pkg.go.dev/builtin#error)\n\nQueueStats retrieves statistics about queues. \n\nRequestHeaders\n--------------\n\n type RequestHeaders struct {\n \tQueueName https://pkg.go.dev/builtin#string\n \tTaskName https://pkg.go.dev/builtin#string\n \tTaskRetryCount https://pkg.go.dev/builtin#int64\n \tTaskExecutionCount https://pkg.go.dev/builtin#int64\n \tTaskETA https://pkg.go.dev/time.https://pkg.go.dev/time#Time\n\n \tTaskPreviousResponse https://pkg.go.dev/builtin#int\n \tTaskRetryReason https://pkg.go.dev/builtin#string\n \tFailFast https://pkg.go.dev/builtin#bool\n }\n\nRequestHeaders are the special HTTP request headers available to push task\nHTTP request handlers. These headers are set internally by App Engine.\nSee \u003chttps://cloud.google.com/appengine/docs/standard/go/taskqueue/push/creating-handlers#reading_request_headers\u003e\nfor a description of the fields. \n\n### func ParseRequestHeaders\n\n func ParseRequestHeaders(h https://pkg.go.dev/net/http.https://pkg.go.dev/net/http#Header) *#google_golang_org_appengine_taskqueue_RequestHeaders\n\nParseRequestHeaders parses the special HTTP request headers available to push\ntask request handlers. This function silently ignores values of the wrong\nformat. \n\nRetryOptions\n------------\n\n type RetryOptions struct {\n \t// Number of tries/leases after which the task fails permanently and is deleted.\n \t// If AgeLimit is also set, both limits must be exceeded for the task to fail permanently.\n \tRetryLimit https://pkg.go.dev/builtin#int32\n\n \t// Maximum time allowed since the task's first try before the task fails permanently and is deleted (only for push tasks).\n \t// If RetryLimit is also set, both limits must be exceeded for the task to fail permanently.\n \tAgeLimit https://pkg.go.dev/time.https://pkg.go.dev/time#Duration\n\n \t// Minimum time between successive tries (only for push tasks).\n \tMinBackoff https://pkg.go.dev/time.https://pkg.go.dev/time#Duration\n\n \t// Maximum time between successive tries (only for push tasks).\n \tMaxBackoff https://pkg.go.dev/time.https://pkg.go.dev/time#Duration\n\n \t// Maximum number of times to double the interval between successive tries before the intervals increase linearly (only for push tasks).\n \tMaxDoublings https://pkg.go.dev/builtin#int32\n\n \t// If MaxDoublings is zero, set ApplyZeroMaxDoublings to true to override the default non-zero value.\n \t// Otherwise a zero MaxDoublings is ignored and the default is used.\n \tApplyZeroMaxDoublings https://pkg.go.dev/builtin#bool\n }\n\nRetryOptions let you control whether to retry a task and the backoff intervals between tries. \n\nTask\n----\n\n type Task struct {\n \t// Path is the worker URL for the task.\n \t// If unset, it will default to /_ah/queue/\n\nA Task represents a task to be executed. \n\n### func Add\n\n func Add(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, task *#google_golang_org_appengine_taskqueue_Task, queueName https://pkg.go.dev/builtin#string) (*#google_golang_org_appengine_taskqueue_Task, https://pkg.go.dev/builtin#error)\n\nAdd adds the task to a named queue.\nAn empty queue name means that the default queue will be used.\nAdd returns an equivalent Task with defaults filled in, including setting\nthe task's Name field to the chosen name if the original was empty. \n\n### func AddMulti\n\n func AddMulti(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, tasks []*#google_golang_org_appengine_taskqueue_Task, queueName https://pkg.go.dev/builtin#string) ([]*#google_golang_org_appengine_taskqueue_Task, https://pkg.go.dev/builtin#error)\n\nAddMulti adds multiple tasks to a named queue.\nAn empty queue name means that the default queue will be used.\nAddMulti returns a slice of equivalent tasks with defaults filled in, including setting\neach task's Name field to the chosen name if the original was empty.\nIf a given task is badly formed or could not be added, an appengine.MultiError is returned. \n\n### func Lease\n\n func Lease(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, maxTasks https://pkg.go.dev/builtin#int, queueName https://pkg.go.dev/builtin#string, leaseTime https://pkg.go.dev/builtin#int) ([]*#google_golang_org_appengine_taskqueue_Task, https://pkg.go.dev/builtin#error)\n\nLease leases tasks from a queue.\nleaseTime is in seconds.\nThe number of tasks fetched will be at most maxTasks. \n\n### func LeaseByTag\n\n func LeaseByTag(c https://pkg.go.dev/context.https://pkg.go.dev/context#Context, maxTasks https://pkg.go.dev/builtin#int, queueName https://pkg.go.dev/builtin#string, leaseTime https://pkg.go.dev/builtin#int, tag https://pkg.go.dev/builtin#string) ([]*#google_golang_org_appengine_taskqueue_Task, https://pkg.go.dev/builtin#error)\n\nLeaseByTag leases tasks from a queue, grouped by tag.\nIf tag is empty, then the returned tasks are grouped by the tag of the task with earliest ETA.\nleaseTime is in seconds.\nThe number of tasks fetched will be at most maxTasks. \n\n### func NewPOSTTask\n\n func NewPOSTTask(path https://pkg.go.dev/builtin#string, params https://pkg.go.dev/net/url.https://pkg.go.dev/net/url#Values) *#google_golang_org_appengine_taskqueue_Task\n\nNewPOSTTask creates a Task that will POST to a path with the given form data."]]