Skip to main content

queues

Creates, updates, deletes, gets or lists a queues resource.

Overview

Namequeues
TypeResource
Idgoogle.cloudtasks.queues

Fields

The following fields are returned by SELECT queries:

Successful response

NameDatatypeDescription
namestringCaller-specified and required in CreateQueue, 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 ListLocations. 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.
appEngineRoutingOverrideobjectOverrides for task-level app_engine_routing. These settings apply only to App Engine tasks in this queue. Http tasks are not affected. If set, app_engine_routing_override is used for all App Engine tasks in the queue, no matter what the setting is for the task-level app_engine_routing. (id: AppEngineRouting)
httpTargetobjectModifies HTTP target for HTTP tasks. (id: HttpTarget)
purgeTimestring (google-datetime)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 PurgeQueue, 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.
rateLimitsobjectRate limits for task dispatches. rate_limits and retry_config are related because they both control task attempts. However they control task attempts in different ways: * rate_limits 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). * retry_config controls what happens to particular a task after its first attempt fails. That is, retry_config 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: rate_limits, retry_config, 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. (id: RateLimits)
retryConfigobjectSettings 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. (id: RetryConfig)
stackdriverLoggingConfigobjectConfiguration options for writing logs to Stackdriver Logging. If this field is unset, then no logs are written. (id: StackdriverLoggingConfig)
statestringOutput only. The state of the queue. state can only be changed by calling PauseQueue, ResumeQueue, or uploading queue.yaml/xml. UpdateQueue cannot be used to change state.

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectprojectsId, locationsId, queuesIdGets a queue.
listselectprojectsId, locationsIdfilter, pageSize, pageTokenLists queues. Queues are returned in lexicographical order.
createinsertprojectsId, locationsIdCreates a queue. Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not. WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.
patchupdateprojectsId, locationsId, queuesIdupdateMaskUpdates a queue. This method creates the queue if it does not exist and updates the queue if it does exist. Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not. WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.
deletedeleteprojectsId, locationsId, queuesIdDeletes a queue. This command will delete the queue even if it has tasks in it. Note: If you delete a queue, you may be prevented from creating a new queue with the same name as the deleted queue for a tombstone window of up to 3 days. During this window, the CreateQueue operation may appear to recreate the queue, but this can be misleading. If you attempt to create a queue with the same name as one that is in the tombstone window, run GetQueue to confirm that the queue creation was successful. If GetQueue returns 200 response code, your queue was successfully created with the name of the previously deleted queue. Otherwise, your queue did not successfully recreate. WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.
purgeexecprojectsId, locationsId, queuesIdPurges a queue by deleting all of its tasks. All tasks created before this method is called are permanently deleted. Purge operations can take up to one minute to take effect. Tasks might be dispatched before the purge takes effect. A purge is irreversible.
pauseexecprojectsId, locationsId, queuesIdPauses the queue. If a queue is paused then the system will stop dispatching tasks until the queue is resumed via ResumeQueue. Tasks can still be added when the queue is paused. A queue is paused if its state is PAUSED.
resumeexecprojectsId, locationsId, queuesIdResume a queue. This method resumes a queue after it has been PAUSED or DISABLED. The state of a queue is stored in the queue's state; after calling this method it will be set to RUNNING. WARNING: Resuming many high-QPS queues at the same time can lead to target overloading. If you are resuming high-QPS queues, follow the 500/50/5 pattern described in Managing Cloud Tasks Scaling Risks.

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
locationsIdstring
projectsIdstring
queuesIdstring
filterstring
pageSizeinteger (int32)
pageTokenstring
updateMaskstring (google-fieldmask)

SELECT examples

Gets a queue.

SELECT
name,
appEngineRoutingOverride,
httpTarget,
purgeTime,
rateLimits,
retryConfig,
stackdriverLoggingConfig,
state
FROM google.cloudtasks.queues
WHERE projectsId = '{{ projectsId }}' -- required
AND locationsId = '{{ locationsId }}' -- required
AND queuesId = '{{ queuesId }}' -- required;

INSERT examples

Creates a queue. Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not. WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.

INSERT INTO google.cloudtasks.queues (
data__name,
data__appEngineRoutingOverride,
data__httpTarget,
data__rateLimits,
data__retryConfig,
data__state,
data__purgeTime,
data__stackdriverLoggingConfig,
projectsId,
locationsId
)
SELECT
'{{ name }}',
'{{ appEngineRoutingOverride }}',
'{{ httpTarget }}',
'{{ rateLimits }}',
'{{ retryConfig }}',
'{{ state }}',
'{{ purgeTime }}',
'{{ stackdriverLoggingConfig }}',
'{{ projectsId }}',
'{{ locationsId }}'
RETURNING
name,
appEngineRoutingOverride,
httpTarget,
purgeTime,
rateLimits,
retryConfig,
stackdriverLoggingConfig,
state
;

UPDATE examples

Updates a queue. This method creates the queue if it does not exist and updates the queue if it does exist. Queues created with this method allow tasks to live for a maximum of 31 days. After a task is 31 days old, the task will be deleted regardless of whether it was dispatched or not. WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.

UPDATE google.cloudtasks.queues
SET
data__name = '{{ name }}',
data__appEngineRoutingOverride = '{{ appEngineRoutingOverride }}',
data__httpTarget = '{{ httpTarget }}',
data__rateLimits = '{{ rateLimits }}',
data__retryConfig = '{{ retryConfig }}',
data__state = '{{ state }}',
data__purgeTime = '{{ purgeTime }}',
data__stackdriverLoggingConfig = '{{ stackdriverLoggingConfig }}'
WHERE
projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND queuesId = '{{ queuesId }}' --required
AND updateMask = '{{ updateMask}}'
RETURNING
name,
appEngineRoutingOverride,
httpTarget,
purgeTime,
rateLimits,
retryConfig,
stackdriverLoggingConfig,
state;

DELETE examples

Deletes a queue. This command will delete the queue even if it has tasks in it. Note: If you delete a queue, you may be prevented from creating a new queue with the same name as the deleted queue for a tombstone window of up to 3 days. During this window, the CreateQueue operation may appear to recreate the queue, but this can be misleading. If you attempt to create a queue with the same name as one that is in the tombstone window, run GetQueue to confirm that the queue creation was successful. If GetQueue returns 200 response code, your queue was successfully created with the name of the previously deleted queue. Otherwise, your queue did not successfully recreate. WARNING: Using this method may have unintended side effects if you are using an App Engine queue.yaml or queue.xml file to manage your queues. Read Overview of Queue Management and queue.yaml before using this method.

DELETE FROM google.cloudtasks.queues
WHERE projectsId = '{{ projectsId }}' --required
AND locationsId = '{{ locationsId }}' --required
AND queuesId = '{{ queuesId }}' --required;

Lifecycle Methods

Purges a queue by deleting all of its tasks. All tasks created before this method is called are permanently deleted. Purge operations can take up to one minute to take effect. Tasks might be dispatched before the purge takes effect. A purge is irreversible.

EXEC google.cloudtasks.queues.purge 
@projectsId='{{ projectsId }}' --required,
@locationsId='{{ locationsId }}' --required,
@queuesId='{{ queuesId }}' --required;