Java 8 はサポートが終了しており、2026 年 1 月 31 日に
非推奨になります。非推奨になると、過去に組織のポリシーを使用して以前のランタイムのデプロイを再度有効にしていた場合でも、Java 8 アプリケーションをデプロイできなくなります。既存の Java 8 アプリケーションは、
非推奨になる日付以降も引き続き実行され、トラフィックを受信します。
サポートされている最新バージョンの Java に移行することをおすすめします。
Java での push キューの使用
コレクションでコンテンツを整理
必要に応じて、コンテンツの保存と分類を行います。
このページでは、push キューの概要について説明します。push キューではタスクを実行するために、HTTP リクエストを App Engine ワーカー サービスにディスパッチします。リクエストは一定の速度で送信されます。タスクが異常終了した場合、サービスはリクエストを再送信して、タスクを再試行します。使用するすべての種類のタスクに対してハンドラを用意する必要があります。1 つのサービスで、複数の種類のタスクに対応する複数のハンドラを使用できます。また、複数のサービスを使用して、複数の種類のタスクを管理することもできます。

タスクの期限
ワーカー サービスでは、push タスク リクエストを受け取ると、ワーカー サービスのスケーリング タイプに応じた期限までにそのリクエストが処理され、HTTP レスポンスが送信される必要があります。
自動スケーリング サービスは、10 分以内に完了する必要があります。手動または基本スケーリング サービスの場合は、最大 24 時間まで実行できます。
200~299 の HTTP レスポンス コードはタスクが成功したことを示し、他のすべての値はタスクが失敗したことを示します。タスクが期限内にレスポンスを返せなかった場合、または無効なレスポンスの値を返した場合、タスクは再試行されます。
失敗したタスクの再試行
push タスク リクエスト ハンドラが 200~299 以外の HTTP ステータス コードを返した場合、またはタスクの期限内にレスポンスを返せなかった場合、キューは成功するまでタスクを再試行します。アプリケーションが大量のリクエストで飽和状態になるのを避けるために、失敗したタスクの再試行頻度はシステムによって徐々に減らされますが、少なくとも 1 時間に 1 回は再試行を繰り返すようにスケジュールが設定されます。
push キューの使用
push キューを使用するには、少なくとも以下の作業が必要です。
- プログラムによってタスクを作成し、作成したタスクをデフォルトの push キューまたは作成済みの 1 つ以上の名前付き push キューに追加します。
- タスクのリクエストを処理するハンドラを作成し、そのハンドラを App Engine サービスに割り当てます。
必要に応じて、以下の作業も行います。
push キューを使用すると、アプリケーションに追加の割り当てが適用されます。
次のステップ
特に記載のない限り、このページのコンテンツはクリエイティブ・コモンズの表示 4.0 ライセンスにより使用許諾されます。コードサンプルは Apache 2.0 ライセンスにより使用許諾されます。詳しくは、Google Developers サイトのポリシーをご覧ください。Java は Oracle および関連会社の登録商標です。
最終更新日 2025-09-04 UTC。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["わかりにくい","hardToUnderstand","thumb-down"],["情報またはサンプルコードが不正確","incorrectInformationOrSampleCode","thumb-down"],["必要な情報 / サンプルがない","missingTheInformationSamplesINeed","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2025-09-04 UTC。"],[[["\u003cp\u003ePush queues dispatch HTTP requests to App Engine worker services, delivering them at a constant rate, and will retry tasks if they fail.\u003c/p\u003e\n"],["\u003cp\u003eEach task requires a handler that processes the task's request, and services can have multiple handlers for different task types.\u003c/p\u003e\n"],["\u003cp\u003eThe deadline for a worker service to respond to a task depends on its scaling type, with automatic scaling services having 10 minutes and manual/basic scaling services having up to 24 hours.\u003c/p\u003e\n"],["\u003cp\u003eA successful task response is indicated by an HTTP status code between 200-299, while any other code or a failure to respond within the deadline results in a retry.\u003c/p\u003e\n"],["\u003cp\u003eWorking with push queues involves creating tasks programmatically and assigning them to queues, as well as writing handlers to process task requests.\u003c/p\u003e\n"]]],[],null,["# Using Push Queues in Java\n\nThis page provides an overview of push queues. Push queues run tasks by\ndispatching HTTP requests to App Engine worker services. The requests are\ndelivered at a constant rate. If a task fails, the service retries the task,\nsending another request. You must provide a handler for every kind of task you\nuse. A single service can have multiple handlers for different kinds of tasks, or\nyou can use different services to manage different task types.\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\nThe task deadline\n-----------------\n\nWhen a worker service receives a push task request, it must handle the request\nand send an HTTP response before a deadline that depends on the [scaling\ntype](/appengine/docs/legacy/standard/java/an-overview-of-app-engine#instances)\nof the worker service.\n\nAutomatic scaling services must finish before 10 minutes have elapsed.\nManual and basic scaling services can run up to 24 hours.\n\nAn HTTP response code between 200--299 indicates success; all other values\nindicate the task failed. If the task fails to respond within the deadline, or\nreturns an invalid response value, the task is retried.\n\nRetrying a failed task\n----------------------\n\nIf a push task request handler returns an HTTP status code outside the range\n200--299, or fails to return any response before the task deadline occurs, the queue\nretries the task until it succeeds. The system backs off gradually to\navoid flooding your application with too many requests, but schedules retry\nattempts for failed tasks to recur at a minimum of once per hour.\n\nWorking with push queues\n------------------------\n\nWhen working with push queues, at a minimum, you'll need to do the following things:\n\n- [Create tasks\n programmatically](/appengine/docs/legacy/standard/java/taskqueue/push/creating-tasks) and add them to the default push queue, or to one or more named push queues that you have created.\n- [Write a\n handler](/appengine/docs/legacy/standard/java/taskqueue/push/creating-handlers) that processes a task's request, and assign the handler to an App Engine service.\n\nOptionally, you can also:\n\n- [Create and customize multiple\n queues](/appengine/docs/legacy/standard/java/taskqueue/push/creating-push-queues) to perform multiple tasks efficiently.\n- [Monitor and manage](/appengine/docs/legacy/standard/java/taskqueue/push/creating-push-queues#monitoring_queues_in_the_console_name_short) your push queues in the Google Cloud console.\n\nWhen you use push queues, your application is subject to additional\n[quotas](/appengine/docs/quotas#Task_Queue).\n\nWhat's next\n-----------\n\n- Learn how to [create push queues](/appengine/docs/legacy/standard/java/taskqueue/push/creating-push-queues)\n- Learn how to [create tasks](/appengine/docs/legacy/standard/java/taskqueue/push/creating-tasks)\n- Learn about [writing handlers](/appengine/docs/legacy/standard/java/taskqueue/push/creating-handlers)\n- Look at an [example](/appengine/docs/legacy/standard/java/taskqueue/push/example)"]]