-
Notifications
You must be signed in to change notification settings - Fork 64
queueref
The queue.yaml file is not supported for this runtime.
The queue.yaml configuration file is used to create and configure almost all
of the task queues (push) (push or pull) your app uses. All App Engine apps come
with an automatically preconfigured push queue named default. Although you do
not create the default queue yourself, you can add other queues or change the
configuration of the default queue using the queue.yaml file.
To configure push queues you can use
either queue.yaml or Queue
Management methods from Cloud
Tasks, but not both
at the same time. Mixing the queue.yaml upload method with Queue Management
methods can produce unexpected results and is not recommended.
For Java apps, the queue.yaml file is stored anywhere in the source code
directory.
To configure pull queues you must use the
queue.yaml file. Cloud Tasks does not support pull queues.
Caution: When uploading a queue.yaml file via the gcloud CLI below version
332.0.0 uses a deprecated interface to the service. Starting on 2022-09-20,
attempts to use the upload method can fail with server errors. To resolve this,
make sure the Cloud Tasks API is enabled in your project and your gcloud CLI is
updated to at least version 332.0.0.
The following a basic example that defines a named queue and overrides the default processing rate:
queue:
- name: my-push-queue
rate: 1/s
The following is a more complex example of a queue.yaml configuration that
demonstrates setting up the number of task tries and modifying the default
processing rate.
queue:
- name: fooqueue
rate: 1/s
retry_parameters:
task_retry_limit: 7
task_age_limit: 2d
- name: barqueue
rate: 1/s
retry_parameters:
min_backoff_seconds: 10
max_backoff_seconds: 200
max_doublings: 0
- name: bazqueue
rate: 1/s
retry_parameters:
min_backoff_seconds: 10
max_backoff_seconds: 200
max_doublings: 3
The queue.yaml file is a YAML file whose root directive is queue. This
directive contains zero or more named queues. Each queue definition can specify
the following elements:
<tr id="rate">
<td>`rate` (push queues)</td>
<td>
Required.
How often tasks are processed on this queue. The value is a number
followed by a slash and a unit of time, where the unit is
`s` for seconds, `m` for minutes, `h`
for hours, or `d` for days. For example, the value
`5/m` says tasks will be processed at a rate of 5 times per
minute. The maximum value for `rate` is `500/s`.
If the number is `0` (such as `0/s`), the queue
is considered "paused," and no tasks are processed.
For more information on this element, see the comparative description of
<a href="/tasks/docs/reference/rpc/google.cloud.tasks.v2#ratelimits">`max_dispatches_per_second`</a> in the Cloud Tasks API reference.
</td>
</tr>
<tr id="retry_parameters">
<td>`retry_parameters`</td>
<td>
Optional.
Configures retry attempts for failed tasks in push queues. This addition allows you
to specify the maximum number of times to retry failed tasks in a
specific queue. You can also set a time limit for retry attempts and
control the interval between attempts.
The retry parameters can contain the following subelements:
<dl>
<dt id="task_retry_limit">`task_retry_limit`</dt>
<dd>
The number of retries. For example, if `0` is specified
and the task *fails*, the task is not *retried* at
all. If `1` is specified and the task *fails*, the
task is retried once. If this parameter is unspecified, the task is
retried indefinitely. If `task_retry_limit` is specified
with `task_age_limit`, the task is retried until both
limits are reached.
</dd>
<dt id="task_age_limit">
`task_age_limit` (push queues)
</dt>
<dd>
The time limit for retrying a failed task, measured from when the
task was first run. The value is a number followed by a unit of
time, where the unit is `s` for seconds, `m`
for minutes, `h` for hours, or `d` for days.
For example, the value `5d` specifies a limit of five
days after the task's first execution attempt. If this parameter
is unspecified, the task is retried indefinitely. If specified with
`task_retry_limit`, App Engine retries the task until
both limits are reached.
</dd>
<dt id="min_backoff_seconds">
`min_backoff_seconds` (push queues)
</dt>
<dd>
The minimum number of seconds to wait before retrying a task after
it fails. The default value is `0.1`.
</dd>
<dt id="max_backoff_seconds">
`max_backoff_seconds` (push queues)
</dt>
<dd>
The maximum number of seconds to wait before retrying a task after
it fails. The default value is `3600`.
</dd>
<dt id="max_doublings">
`max_doublings` (push queues)
</dt>
<dd>
The maximum number of times that the interval between failed task
retries will be doubled before the increase becomes constant. The
constant is: `2**max_doublings * min_backoff_seconds`.
The default value is `16`.
</dd>
</dl>
</td>
</tr>
<tr id="target">
<td>`target` (push queues)</td>
<td>
Optional.
A string naming a service/version, a frontend version, or a backend,
on which to execute all of the tasks enqueued onto this queue. The
default value is the empty string.
The string is prepended to the domain name of your app when
constructing the HTTP request for a task. For example, if your app ID
is `my-app` and you set the target to
`my-version-dot-my-service`, the URL hostname will be set to
<code>my-version-dot-my-service-dot-my-app.<var><a href="#appengine-urls"
style="border-bottom: 1px dotted #999"
class="devsite-dialog-button" data-modal-dialog-id="regional_url"
track-type="progressiveHelp" track-name="modalHelp"
track-metadata-goal="regionalURL">REGION_ID</a></var>.r.appspot.com</code>.
If target is unspecified, then tasks are invoked on the same version
of the application where they were enqueued. So, if you enqueued a
task from the default application version without specifying a target
on the queue, the task is invoked in the default application version.
Note that if the default application version changes between the time
that the task is enqueued and the time that it executes, then the task
will run in the new default version.
If you are using services along with a <a
href="/appengine/docs/standard/reference/dispatch-yaml">dispatch
file</a>, your task's HTTP request might be intercepted and re-routed
to another service.
</td>
</tr>
| Element | Description |
|---|---|
| `bucket_size` (push queues) |
All apps have a push queue named default. This queue has a preset rate
of 5 tasks per second. Note that this default queue doesn't display in
the until the first time it is used or configured.
You can configure the default queue, including changing the default rate,
by defining a queue named |
The following elements can be specified for all queues within an app:
| Element | Description |
|---|---|
| `total_storage_limit` |
total_storage_limit: 1.2G
queue:
- name: fooqueue<queue-entries>
<total-storage-limit>1.2G</total-storage-limit>
<queue>
<name>fooqueue</name>
</queue>
</queue-entries> |
The queue.yaml file can reside anywhere in your source code directory.
To deploy the queue configuration file without otherwise altering the currently serving version, use one of the following commands in the directory containing your queue file, depending on your environment:
-
{gcloud}
gcloud app deploy queue.yaml -
{Maven}
mvn appengine:deployQueue queue.yaml -
{Gradle}
gradle appengineDeployQueue queue.yaml -
{IDE}
If you use [IntelliJ](https://cloud.google.com/tools/intellij/docs/deploy-std) or [Eclipse](eclipse/docs/deploying), you select the individual configuration files to be deployed using the deployment form.
The queue.yaml file should reside in your source code directory with your
application code, for example, with the .go file.
The queue.yaml file should reside in the root directory or in the directory
that defines the default service.
To deploy the queue configuration file, run the following command:
gcloud app deploy queue.yaml
To delete a queue:
-
Remove the queue definition from your
queue.yamlfile. -
Upload the change to your
queue.yamlfile.gcloud app deploy queue.yaml -
Delete the queue in the Google Cloud console, select the queue and click Delete queue:
If you delete a queue from the Google Cloud console, you must wait 7 days before recreating with the same name.