REST Resource: projects.locations.queues

Resource: Queue

A queue is a container of related tasks. Queues are configured to manage how those tasks are dispatched. Configurable properties include rate limits, retry options, queue types, and others.

JSON representation
{
  "name": string,
  "rateLimits": {
    object (RateLimits)
  },
  "retryConfig": {
    object (RetryConfig)
  },
  "state": enum (State),
  "purgeTime": string,
  "stackdriverLoggingConfig": {
    object (StackdriverLoggingConfig)
  },
  "appEngineHttpQueue": {
    object (AppEngineHttpQueue)
  }
}
Fields
name

string

Caller-specified and required in queues.create, after which it becomes output only.

The queue name.

The queue name must have the following format: projects/PROJECT_ID/locations/LOCATION_ID/queues/QUEUE_ID

  • PROJECT_ID can contain letters ([A-Za-z]), numbers ([0-9]), hyphens (-), colons (:), or periods (.). For more information, see Identifying projects
  • LOCATION_ID is the canonical ID for the queue's location. The list of available locations can be obtained by calling locations.list. For more information, see https://cloud.google.com/about/locations/.
  • QUEUE_ID can contain letters ([A-Za-z]), numbers ([0-9]), or hyphens (-). The maximum length is 100 characters.

rateLimits

object (RateLimits)

Rate limits for task dispatches.

rateLimits and retryConfig are related because they both control task attempts. However they control task attempts in different ways:

  • rateLimits controls the total rate of dispatches from a queue (i.e. all traffic dispatched from the queue, regardless of whether the dispatch is from a first attempt or a retry).
  • retryConfig controls what happens to particular a task after its first attempt fails. That is, retryConfig controls task retries (the second attempt, third attempt, etc).

The queue's actual dispatch rate is the result of:

  • Number of tasks in the queue
  • User-specified throttling: rateLimits, retryConfig, and the queue's state.
  • System throttling due to 429 (Too Many Requests) or 503 (Service Unavailable) responses from the worker, high error rates, or to smooth sudden large traffic spikes.

retryConfig

object (RetryConfig)

Settings that determine the retry behavior.

  • For tasks created using Cloud Tasks: the queue-level retry settings apply to all tasks in the queue that were created using Cloud Tasks. Retry settings cannot be set on individual tasks.
  • For tasks created using the App Engine SDK: the queue-level retry settings apply to all tasks in the queue which do not have retry settings explicitly set on the task and were created by the App Engine SDK. See App Engine documentation.

state

enum (State)

Output only. The state of the queue.

state can only be changed by called queues.pause, queues.resume, or uploading queue.yaml/xml. queues.patch cannot be used to change state.

purgeTime

string (Timestamp format)

Output only. The last time this queue was purged.

All tasks that were created before this time were purged.

A queue can be purged using queues.purge, the App Engine Task Queue SDK, or the Cloud Console.

Purge time will be truncated to the nearest microsecond. Purge time will be unset if the queue has never been purged.

A timestamp in RFC3339 UTC "Zulu" format, accurate to nanoseconds. Example: "2014-10-02T15:01:23.045123456Z".

stackdriverLoggingConfig

object (StackdriverLoggingConfig)

Configuration options for writing logs to Stackdriver Logging. If this field is unset, then no logs are written.

appEngineHttpQueue

object (AppEngineHttpQueue)

AppEngineHttpQueue settings apply only to App Engine tasks in this queue. Http tasks are not affected by this proto.

AppEngineHttpQueue

App Engine HTTP queue.

The task will be delivered to the App Engine application hostname specified by its AppEngineHttpQueue and AppEngineHttpRequest. The documentation for AppEngineHttpRequest explains how the task's host URL is constructed.

Using AppEngineHttpQueue requires appengine.applications.get Google IAM permission for the project and the following scope:

https://www.googleapis.com/auth/cloud-platform

JSON representation
{
  "appEngineRoutingOverride": {
    object (AppEngineRouting)
  }
}
Fields
appEngineRoutingOverride

object (AppEngineRouting)

Overrides for the task-level appEngineRouting.

If set, appEngineRoutingOverride is used for all tasks in the queue, no matter what the setting is for the task-level appEngineRouting.

RateLimits

Rate limits.

This message determines the maximum rate that tasks can be dispatched by a queue, regardless of whether the dispatch is a first task attempt or a retry.

Note: The debugging command, tasks.run, will run a task even if the queue has reached its RateLimits.

JSON representation
{
  "maxDispatchesPerSecond": number,
  "maxBurstSize": number,
  "maxConcurrentDispatches": number
}
Fields
maxDispatchesPerSecond

number

The maximum rate at which tasks are dispatched from this queue.

If unspecified when the queue is created, Cloud Tasks will pick the default.

This field has the same meaning as rate in queue.yaml/xml.

maxBurstSize

number

Output only. The max burst size.

Max burst size limits how fast tasks in queue are processed when many tasks are in the queue and the rate is high. This field allows the queue to have a high rate so processing starts shortly after a task is enqueued, but still limits resource usage when many tasks are enqueued in a short period of time.

The token bucket algorithm is used to control the rate of task dispatches. Each queue has a token bucket that holds tokens, up to the maximum specified by maxBurstSize. Each time a task is dispatched, a token is removed from the bucket. Tasks will be dispatched until the queue's bucket runs out of tokens. The bucket will be continuously refilled with new tokens based on maxDispatchesPerSecond.

Cloud Tasks will pick the value of maxBurstSize based on the value of maxDispatchesPerSecond.

For App Engine queues that were created or updated using queue.yaml/xml, maxBurstSize is equal to bucket_size. Since maxBurstSize is output only, if queues.patch is called on a queue created by queue.yaml/xml, maxBurstSize will be reset based on the value of maxDispatchesPerSecond, regardless of whether maxDispatchesPerSecond is updated.

maxConcurrentDispatches

number

The maximum number of concurrent tasks that Cloud Tasks allows to be dispatched for this queue. After this threshold has been reached, Cloud Tasks stops dispatching tasks until the number of concurrent requests decreases.

If unspecified when the queue is created, Cloud Tasks will pick the default.

The maximum allowed value is 5,000.

This field has the same meaning as max_concurrent_requests in queue.yaml/xml.

RetryConfig

Retry config.

These settings determine when a failed task attempt is retried.

JSON representation
{
  "maxAttempts": number,
  "maxRetryDuration": string,
  "minBackoff": string,
  "maxBackoff": string,
  "maxDoublings": number
}
Fields
maxAttempts

number

Number of attempts per task.

Cloud Tasks will attempt the task maxAttempts times (that is, if the first attempt fails, then there will be maxAttempts - 1 retries). Must be >= -1.

If unspecified when the queue is created, Cloud Tasks will pick the default.

-1 indicates unlimited attempts.

This field has the same meaning as task_retry_limit in queue.yaml/xml.

maxRetryDuration

string (Duration format)

If positive, maxRetryDuration specifies the time limit for retrying a failed task, measured from when the task was first attempted. Once maxRetryDuration time has passed and the task has been attempted maxAttempts times, no further attempts will be made and the task will be deleted.

If zero, then the task age is unlimited.

If unspecified when the queue is created, Cloud Tasks will pick the default.

maxRetryDuration will be truncated to the nearest second.

This field has the same meaning as taskAgeLimit in queue.yaml/xml.

A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

minBackoff

string (Duration format)

A task will be scheduled for retry between minBackoff and maxBackoff duration after it fails, if the queue's RetryConfig specifies that the task should be retried.

If unspecified when the queue is created, Cloud Tasks will pick the default.

minBackoff will be truncated to the nearest second.

This field has the same meaning as min_backoff_seconds in queue.yaml/xml.

A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

maxBackoff

string (Duration format)

A task will be scheduled for retry between minBackoff and maxBackoff duration after it fails, if the queue's RetryConfig specifies that the task should be retried.

If unspecified when the queue is created, Cloud Tasks will pick the default.

maxBackoff will be truncated to the nearest second.

This field has the same meaning as max_backoff_seconds in queue.yaml/xml.

A duration in seconds with up to nine fractional digits, terminated by 's'. Example: "3.5s".

maxDoublings

number

The time between retries will double maxDoublings times.

A task's retry interval starts at minBackoff, then doubles maxDoublings times, then increases linearly, and finally retries retries at intervals of maxBackoff up to maxAttempts times.

For example, if minBackoff is 10s, maxBackoff is 300s, and maxDoublings is 3, then the a task will first be retried in 10s. The retry interval will double three times, and then increase linearly by 2^3 * 10s. Finally, the task will retry at intervals of maxBackoff until the task has been attempted maxAttempts times. Thus, the requests will retry at 10s, 20s, 40s, 80s, 160s, 240s, 300s, 300s, ....

If unspecified when the queue is created, Cloud Tasks will pick the default.

This field has the same meaning as maxDoublings in queue.yaml/xml.

State

State of the queue.

Enums
STATE_UNSPECIFIED Unspecified state.
RUNNING

The queue is running. Tasks can be dispatched.

If the queue was created using Cloud Tasks and the queue has had no activity (method calls or task dispatches) for 30 days, the queue may take a few minutes to re-activate. Some method calls may return google.rpc.Code.NOT_FOUND and tasks may not be dispatched for a few minutes until the queue has been re-activated.

PAUSED Tasks are paused by the user. If the queue is paused then Cloud Tasks will stop delivering tasks from it, but more tasks can still be added to it by the user.
DISABLED

The queue is disabled.

A queue becomes DISABLED when queue.yaml or queue.xml is uploaded which does not contain the queue. You cannot directly disable a queue.

When a queue is disabled, tasks can still be added to a queue but the tasks are not dispatched.

To permanently delete this queue and all of its tasks, call queues.delete.

StackdriverLoggingConfig

Configuration options for writing logs to Stackdriver Logging.

JSON representation
{
  "samplingRatio": number
}
Fields
samplingRatio

number

Specifies the fraction of operations to write to Stackdriver Logging. This field may contain any value between 0.0 and 1.0, inclusive. 0.0 is the default and means that no operations are logged.

Methods

create

Creates a queue.

delete

Deletes a queue.

get

Gets a queue.

getIamPolicy

Gets the access control policy for a Queue.

list

Lists queues.

patch

Updates a queue.

pause

Pauses the queue.

purge

Purges a queue by deleting all of its tasks.

resume

Resume a queue.

setIamPolicy

Sets the access control policy for a Queue.

testIamPermissions

Returns permissions that a caller has on a Queue.
本頁內容對您是否有任何幫助?請提供意見:

傳送您對下列選項的寶貴意見...

這個網頁
Cloud Tasks