Skip to main content

queues

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

Overview

Namequeues
TypeResource
Idgoogle.cloudtasks.queues

Fields

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.
appEngineRoutingOverrideobjectApp Engine Routing. Defines routing characteristics specific to App Engine - service, version, and instance. For more information about services, versions, and instances see An Overview of App Engine, Microservices Architecture on Google App Engine, App Engine Standard request routing, and App Engine Flex request routing. Using AppEngineRouting requires appengine.applications.get Google IAM permission for the project and the following scope: https://www.googleapis.com/auth/cloud-platform
httpTargetobjectHTTP target. When specified as a Queue, all the tasks with [HttpRequest] will be overridden according to the target.
purgeTimestringOutput 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. 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, RunTask, will run a task even if the queue has reached its RateLimits.
retryConfigobjectRetry config. These settings determine when a failed task attempt is retried.
stackdriverLoggingConfigobjectConfiguration options for writing logs to Stackdriver Logging.
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

NameAccessible byRequired ParamsDescription
getSELECTlocationsId, projectsId, queuesIdGets a queue.
listSELECTlocationsId, projectsIdLists queues. Queues are returned in lexicographical order.
createINSERTlocationsId, projectsIdCreates 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.
deleteDELETElocationsId, projectsId, 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.
patchUPDATElocationsId, projectsId, queuesIdUpdates 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.
pauseEXEClocationsId, projectsId, 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.
purgeEXEClocationsId, projectsId, 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.
resumeEXEClocationsId, projectsId, 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.

SELECT examples

Lists queues. Queues are returned in lexicographical order.

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

INSERT example

Use the following StackQL query and manifest file to create a new queues resource.

/*+ create */
INSERT INTO google.cloudtasks.queues (
locationsId,
projectsId,
name,
appEngineRoutingOverride,
httpTarget,
rateLimits,
retryConfig,
state,
purgeTime,
stackdriverLoggingConfig
)
SELECT
'{{ locationsId }}',
'{{ projectsId }}',
'{{ name }}',
'{{ appEngineRoutingOverride }}',
'{{ httpTarget }}',
'{{ rateLimits }}',
'{{ retryConfig }}',
'{{ state }}',
'{{ purgeTime }}',
'{{ stackdriverLoggingConfig }}'
;

UPDATE example

Updates a queues resource.

/*+ update */
UPDATE google.cloudtasks.queues
SET
name = '{{ name }}',
appEngineRoutingOverride = '{{ appEngineRoutingOverride }}',
httpTarget = '{{ httpTarget }}',
rateLimits = '{{ rateLimits }}',
retryConfig = '{{ retryConfig }}',
state = '{{ state }}',
purgeTime = '{{ purgeTime }}',
stackdriverLoggingConfig = '{{ stackdriverLoggingConfig }}'
WHERE
locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}'
AND queuesId = '{{ queuesId }}';

DELETE example

Deletes the specified queues resource.

/*+ delete */
DELETE FROM google.cloudtasks.queues
WHERE locationsId = '{{ locationsId }}'
AND projectsId = '{{ projectsId }}'
AND queuesId = '{{ queuesId }}';