Java 8 has reached end of support
and will be
deprecated
on January 31, 2026. After deprecation, you won't be able to deploy Java 8
applications, even if your organization previously used an organization policy to
re-enable deployments of legacy runtimes. Your existing Java
8 applications will continue to run and receive traffic after their
deprecation date. We recommend that
you
migrate to the latest supported version of Java.
Using Pull Queues in Java
Stay organized with collections
Save and categorize content based on your preferences.
This page provides an overview of pull queues in the App Engine
standard environment.
In push queues tasks are delivered to a worker service
based on the queue's configuration. In pull queues the worker service must ask
the queue for tasks. The queue responds by allowing that worker unique access
to process the task for a specified period of time, which is called a lease.

Using pull queues, you can also group related tasks using tags and then configure your
worker to pull multiple tasks with a certain tag all at once. This process is
called batching.
If a worker cannot process a task before its lease expires, it can either renew the
lease or let it expire, at which point another worker can acquire it. Once the
work associated with a task is complete, the worker must delete it.
Using pull queues requires your code to handle some functions that are automated
in push queues:
- Scaling your workers
- Your code needs to scale the number of workers based on
processing volume. If your code does not handle scaling, you risk
wasting computing resources if there are no tasks to process; you also risk
latency if you have too many tasks to process.
- Deleting the tasks
- Your code also needs to explicitly delete tasks after processing.
In push queues, App Engine deletes the tasks for you. If your worker does
not delete pull queue tasks after processing, another worker will re-process
the task. This wastes computing resources and risks errors if tasks are
not idempotent.
Pull queues in the App Engine standard environment are created by setting a property in a
configuration file called queue.xml
.
Pull queue workflow
Workers that process tasks from pull queues must be defined within a service that runs
in the App Engine standard environment.
The workflow is as follows:
- You create a pull queue, using
queue.xml
.
- You create tasks and add them to the queue.
- The worker you have created leases the task, using TaskQueue.
- App Engine sends task data to the worker in the lease response.
- The worker processes the task. If the task fails to execute before the lease
expires, the worker can modify the lease duration. If the lease expires, the
task will be available to be leased to another worker.
- After a task is processed successfully, the worker deletes it.
What's next
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-08-25 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Hard to understand","hardToUnderstand","thumb-down"],["Incorrect information or sample code","incorrectInformationOrSampleCode","thumb-down"],["Missing the information/samples I need","missingTheInformationSamplesINeed","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2025-08-25 UTC."],[[["\u003cp\u003ePull queues in the App Engine standard environment require worker services to actively request tasks, unlike push queues where tasks are automatically delivered.\u003c/p\u003e\n"],["\u003cp\u003eWorkers using pull queues can utilize task grouping with tags and batching to handle related tasks efficiently.\u003c/p\u003e\n"],["\u003cp\u003ePull queue workers must manage scaling and explicitly delete tasks after processing to prevent resource waste and errors.\u003c/p\u003e\n"],["\u003cp\u003eThe pull queue workflow involves creating queues and tasks, leasing tasks to workers, processing tasks, and then deleting completed tasks.\u003c/p\u003e\n"],["\u003cp\u003ePull queues are configured using a \u003ccode\u003equeue.xml\u003c/code\u003e file within the App Engine standard environment.\u003c/p\u003e\n"]]],[],null,["# Using Pull Queues in Java\n\nThis page provides an overview of pull queues in the App Engine\nstandard environment.\n| This API is supported for first-generation runtimes and can be used when [upgrading to corresponding second-generation runtimes](/appengine/docs/standard/\n| java-gen2\n|\n| /services/access). If you are updating to the App Engine Java 11/17 runtime, refer to the [migration guide](/appengine/migration-center/standard/migrate-to-second-gen/java-differences) to learn about your migration options for legacy bundled services.\n\nIn *push* queues tasks are delivered to a worker service\nbased on the queue's configuration. In *pull* queues the worker service must *ask*\nthe queue for tasks. The queue responds by allowing that worker unique access\nto process the task for a specified period of time, which is called a *lease*.\n\nUsing pull queues, you can also group related tasks using tags and then configure your\nworker to pull multiple tasks with a certain tag all at once. This process is\ncalled *batching*.\n\nIf a worker cannot process a task before its lease expires, it can either renew the\nlease or let it expire, at which point another worker can acquire it. Once the\nwork associated with a task is complete, the worker must delete it.\n\nUsing pull queues requires your code to handle some functions that are automated\nin push queues:\n\nScaling your workers\n: Your code needs to scale the number of workers based on\n processing volume. If your code does not handle scaling, you risk\n wasting computing resources if there are no tasks to process; you also risk\n latency if you have too many tasks to process.\n\nDeleting the tasks\n: Your code also needs to explicitly delete tasks after processing.\n In push queues, App Engine deletes the tasks for you. If your worker does\n not delete pull queue tasks after processing, another worker will re-process\n the task. This wastes computing resources and risks errors if tasks are\n not [idempotent](https://wikipedia.org/wiki/Idempotence).\n\nPull queues in the App Engine standard environment are created by setting a property in a\nconfiguration file called `queue.xml`.\n\nPull queue workflow\n-------------------\n\nWorkers that process tasks from pull queues must be defined within a service that runs\nin the App Engine standard environment.\n\nThe workflow is as follows:\n\n1. You [create a pull queue](/appengine/docs/legacy/standard/java/taskqueue/pull/creating-pull-queues), using `queue.xml`.\n2. You [create tasks](/appengine/docs/legacy/standard/java/taskqueue/pull/creating-tasks) and add them to the queue.\n3. The worker you have created [leases the task](/appengine/docs/legacy/standard/java/taskqueue/pull/leasing-pull-tasks), using [TaskQueue.](/appengine/docs/legacy/standard/java/javadoc/com/google/appengine/api/taskqueue/package-summary)\n4. App Engine sends task data to the worker in the lease response.\n5. The worker processes the task. If the task fails to execute before the lease expires, the worker can modify the lease duration. If the lease expires, the task will be available to be leased to another worker.\n6. After a task is processed successfully, the [worker deletes it](/appengine/docs/legacy/standard/java/taskqueue/pull/leasing-pull-tasks#deleting-tasks).\n\nWhat's next\n-----------\n\n- Learn how to [create pull queues](/appengine/docs/legacy/standard/java/taskqueue/pull/creating-pull-queues)."]]