Restez organisé à l'aide des collections
Enregistrez et classez les contenus selon vos préférences.
Cette page explique comment créer une file d'attente de retrait. Vous devez créer la file d'attente avant de pouvoir y ajouter des tâches. Vous apprendrez également à suspendre et à supprimer une file d'attente.
Définir des files d'attente avec queue.yaml
Pour créer des files d'attente de retrait, utilisez le fichier queue.yaml de votre application.
Le processus est le même que pour la création de files d'attente d'envoi nommées, avec une directive spécialisée mode: pull ajoutée au fichier.
queue:-name:my-queue-namemode:pull
Vous utilisez la commande gcloud de gcloud CLI pour importer le fichier.
gcloudappdeployqueue.yaml
Désactiver des files d'attente
Vous pouvez désactiver ou suspendre une file d'attente en supprimant sa définition du fichier de configuration de la file d'attente, puis en important le fichier modifié.
Une fois le fichier mis à jour importé, la file d'attente est définie sur "désactivée" et sa valeur sur 0. Aucune des tâches figurant dans la file d'attente ou y étant ajoutées ne sera traitée. Vous pouvez réactiver la file d'attente désactivée en important un nouveau fichier de file d'attente dans lequel la file d'attente est définie.
Si vous supprimez une file d'attente de la console Google Cloud, vous devez attendre sept jours avant de pouvoir recréer une file d'attente portant le même nom.
Sauf indication contraire, le contenu de cette page est régi par une licence Creative Commons Attribution 4.0, et les échantillons de code sont régis par une licence Apache 2.0. Pour en savoir plus, consultez les Règles du site Google Developers. Java est une marque déposée d'Oracle et/ou de ses sociétés affiliées.
Dernière mise à jour le 2025/04/21 (UTC).
[[["Facile à comprendre","easyToUnderstand","thumb-up"],["J'ai pu résoudre mon problème","solvedMyProblem","thumb-up"],["Autre","otherUp","thumb-up"]],[["Difficile à comprendre","hardToUnderstand","thumb-down"],["Informations ou exemple de code incorrects","incorrectInformationOrSampleCode","thumb-down"],["Il n'y a pas l'information/les exemples dont j'ai besoin","missingTheInformationSamplesINeed","thumb-down"],["Problème de traduction","translationIssue","thumb-down"],["Autre","otherDown","thumb-down"]],["Dernière mise à jour le 2025/04/21 (UTC)."],[[["\u003cp\u003eThis guide details the process of creating pull queues using the \u003ccode\u003equeue.yaml\u003c/code\u003e file, which requires adding a \u003ccode\u003emode: pull\u003c/code\u003e directive and deploying the file via the \u003ccode\u003egcloud app deploy queue.yaml\u003c/code\u003e command.\u003c/p\u003e\n"],["\u003cp\u003ePull queues can be paused by removing their definition from the \u003ccode\u003equeue.yaml\u003c/code\u003e file and re-deploying, effectively setting the queue's rate to 0, but can be re-enabled by adding them back in.\u003c/p\u003e\n"],["\u003cp\u003eDeleting a pull queue involves first disabling it by removing its definition from \u003ccode\u003equeue.yaml\u003c/code\u003e, uploading the updated file, and then using the Google Cloud console to complete the deletion.\u003c/p\u003e\n"],["\u003cp\u003eUsing a service account for queue configuration deployment requires the \u003ccode\u003eserviceusage.services.list\u003c/code\u003e permission, accessible through the \u003ccode\u003eserviceusage.serviceUsageViewer\u003c/code\u003e role or a custom role.\u003c/p\u003e\n"],["\u003cp\u003eMixing the \u003ccode\u003equeue.yaml\u003c/code\u003e method with Queue Management methods is discouraged, and using \u003ccode\u003egcloud\u003c/code\u003e CLI versions older than \u003ccode\u003e332.0.0\u003c/code\u003e for uploading \u003ccode\u003equeue.yaml\u003c/code\u003e can result in errors, requiring an update and enabled Cloud Tasks API.\u003c/p\u003e\n"]]],[],null,["# Creating Pull Queues\n\nThis page describes how to create a pull queue. You must create the queue before\nyou can add tasks to it. The page also describes how to pause or delete a queue.\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| python3\n|\n| /services/access). If you are updating to the App Engine Python 3 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/python-differences) to learn about your migration options for legacy bundled services.\n\nDefining queues with `queue.yaml`\n---------------------------------\n\nYou can define pull queues using the `queue.yaml` file for your application.\nThe process is the same as [creating named push queues](/appengine/docs/legacy/standard/python/taskqueue/push/creating-push-queues), with a specialized directive, [`mode: pull`](/appengine/docs/legacy/standard/python/config/queueref#mode), added to the file. \n\n queue:\n - name: my-queue-name\n mode: pull\n\nYou use the gcloud CLI `gcloud` command to upload the file. \n\n gcloud app deploy queue.yaml\n\n| **Note:** If you are using a service account to manage authentication for deploying your queue configuration file, it needs to have the `serviceusage.services.list` permission. This permission can be added either using the [`serviceusage.serviceUsageViewer`](/iam/docs/understanding-roles#service-usage-roles) role or by creating a [custom role](/iam/docs/understanding-custom-roles) with that permission.\n| **Caution:** Queue creation for the Task Queue service can also be managed using Queue Management methods available directly through the Cloud Tasks API, but mixing the `queue.yaml` upload method with Queue Management methods can produce unexpected results and is not recommended. For more information, see [Overview of Queue Management and queue.yaml](/tasks/docs/queue-yaml). Also note that 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`.\n\nDisabling queues\n----------------\n\nYou can disable, or pause, a queue by removing its definition from your queue\nconfiguration file and then uploading the updated file.\n\nOnce the updated file is uploaded, the queue is set to \"disabled\" and\nits rate is set to 0. Any tasks that are in the queue or new tasks that are\nadded to the queue will not be processed. You can re-enable the disabled queue\nby uploading a new queue file with the queue defined.\n\nYou can also pause a queue from within the\n[Cloud Tasks page in the Google Cloud console](https://console.cloud.google.com/cloudtasks).\n\nDeleting queues\n---------------\n\nTo delete a queue you must first disable it:\n\n1. Remove the queue definition from your queue configuration file.\n\n2. Upload the changed file.\n\n gcloud app deploy queue.yaml\n\nOnce the queue is disabled, use the Google Cloud console to delete it.\n\n1. In the Google Cloud console, select the queue.\n\n [Go to Cloud Tasks](https://console.cloud.google.com/cloudtasks)\n2. Click **Delete queue**.\n\nIf you delete a queue from the Google Cloud console, you must wait 7 days\nbefore recreating with the same name.\n| **Important:** The local development server (`dev_appserver`) does not support pull queues. To test your pull queues and make sure you have the details of your configuration correct, you'll need to push your queue configuration file to an App Engine staging environment.\n\nWhat's next\n-----------\n\nLearn how to [create tasks](/appengine/docs/legacy/standard/python/taskqueue/pull/creating-tasks)."]]