Eseguire la migrazione da code di attività a Cloud Tasks
Mantieni tutto organizzato con le raccolte
Salva e classifica i contenuti in base alle tue preferenze.
Puoi eseguire la migrazione dall'utilizzo del servizio coda dell'ambiente standard di App Engine (coda di attività) tramite l'API Task Queue di App Engine all'accesso allo stesso servizio utilizzando Cloud Tasks, una nuova API RPC/REST. Cloud Tasks può essere impiegato al di fuori dei runtime di App Engine di prima generazione, in particolare da tutti gli ambienti flessibili di App Engine, nonché dai runtime dell'ambiente standard di App Engine di seconda generazione.
Cloud Tasks e l'attuale servizio di coda di task dell'ambiente standard di App Engine esistono in un unico universo. Puoi aggiungere alle stesse code tramite entrambe le API. Indipendentemente dall'utilizzo dell'SDK App Engine o della nuova API Cloud Tasks , una coda all'interno dell'app inoltra un'attività a un URL di gestore per l'elaborazione asincrona.
Nuove funzionalità
Cloud Tasks fornisce alcune funzionalità non disponibili tramite l'SDK App Engine, tra cui:
Gestione della coda tramite l'API:
Puoi creare, eliminare, mettere in pausa ed eseguire altre attività di gestione della coda utilizzando l'API, la console o il comando gcloud.
Comando Elenco code:
Puoi elencare tutte le code che hai configurato nel progetto.
Comando Elenco attività:
Puoi elencare tutte le attività in una delle tue code.
Integrazione di Identity and Access Management (IAM):
Puoi proteggere l'accesso alle code e alle attività in modo estremamente granulare utilizzando IAM.
Target HTTP
Puoi scegliere come target i gestori in qualsiasi endpoint HTTP con un indirizzo IP pubblico.
Funzionalità di Task Queues non ancora disponibili tramite l'API Cloud Tasks :
Cloud Tasks non supporta l'inserimento di un'attività in coda nell'ambito di una transazione Cloud Datastore, pertanto l'attività viene inserita in coda solo se la transazione viene eseguita correttamente e viene garantito che venga inserita in coda.
In alcuni casi, potresti aver bisogno di una serie di piccole attività diverse gestite in modo asincrono, ma non vuoi dover configurare singoli gestori distinti. L'SDK App Engine ti consente di utilizzare librerie specifiche per il runtime per creare funzioni semplici per gestire queste attività. Questa funzionalità non è disponibile in Cloud Tasks. Tieni presente, però, che
le attività normali possono essere pianificate in futuro utilizzando Cloud Tasks.
Alcuni dei runtime che utilizzano l'SDK App Engine dispongono di API che supportano la multitenancy delle attività tramite il nome. Questa funzionalità non è disponibile in Cloud Tasks.
Il server di sviluppo locale fornito dall'interfaccia a riga di comando gcloud o dall'SDK App Engine
non supporta gli endpoint simulati per le chiamate all'API Cloud Tasks.
Gli utenti dell'SDK App Engine possono scegliere di aggiungere attività alle code in modo asincrono.
Questa funzionalità non è disponibile in Cloud Tasks.
Per maggiori informazioni
Puoi trovare guide più dettagliate per la migrazione del codice nel set di documentazione della coda di attività di App Engine:
[[["Facile da capire","easyToUnderstand","thumb-up"],["Il problema è stato risolto","solvedMyProblem","thumb-up"],["Altra","otherUp","thumb-up"]],[["Difficile da capire","hardToUnderstand","thumb-down"],["Informazioni o codice di esempio errati","incorrectInformationOrSampleCode","thumb-down"],["Mancano le informazioni o gli esempi di cui ho bisogno","missingTheInformationSamplesINeed","thumb-down"],["Problema di traduzione","translationIssue","thumb-down"],["Altra","otherDown","thumb-down"]],["Ultimo aggiornamento 2025-09-04 UTC."],[],[],null,["# Migrate from Task Queues to Cloud Tasks\n\nYou can migrate from using App Engine standard environment's queue service\n(Task Queues) via the App Engine Task Queue API to accessing that same service\nusing Cloud Tasks, a new RPC/REST API. Cloud Tasks can be\nemployed outside of first generation App Engine runtimes, particularly from all\n[App Engine flexible environments](/appengine/docs/flexible), as well as from\n[second generation App Engine standard environment\nruntimes](/appengine/docs/standard/runtimes).\n\nCloud Tasks and the current App Engine standard environment\ntask queue service exist in a single universe. You can add to the same\nqueues through either API. Regardless of whether you use the App Engine SDK\nor the new Cloud Tasks API , a queue within the app forwards a task to a\nhandler URL for asynchronous processing.\n\n### New features\n\nCloud Tasks provides some features not available via the App Engine\nSDK, including the following:\n\n- Queue management via the API:\n\n You can create, delete, pause, and perform other queue management tasks\n using the API, through the Console, or via the `gcloud` command.\n- List Queues command:\n\n You can list all the queues you have set up in your project.\n- List Tasks command:\n\n You can list all the tasks in any of your queues.\n- Identity and Access Management (IAM) integration:\n\n You can secure access to your queues and tasks in a highly granular way\n using [IAM](/iam).\n- HTTP Targets\n\n You can target handlers at any HTTP endpoint with a public IP address.\n\n### Features in Task Queues not yet available via Cloud Tasks API :\n\n- [Pull queues](/appengine/docs/standard/python/taskqueue/pull):\n\n You can use [Cloud Pub/Sub](/pubsub), a GA product, to implement many of\n the same use cases as pull queues.\n- [Transactional tasks](/appengine/docs/standard/python/taskqueue/push/creating-tasks#enqueuing_tasks_in_cloud_datastore_transactions):\n\n Cloud Tasks does not support enqueuing a task as part of a\n Cloud Datastore transaction, such that the task is only enqueued - and is\n guaranteed to be enqueued - if the transaction is committed successfully.\n- [Deferred/delayed tasks](/appengine/docs/standard/python/taskqueue/push/creating-tasks#using_the_instead_of_a_worker_service):\n\n In some cases where you might need a series of diverse small tasks handled\n asynchronously but you don't want to go through the work of setting up\n individual distinct handlers, the App Engine SDK allows you to use runtime\n specific libraries to create simple functions to manage these tasks. This\n feature is not available in Cloud Tasks. Note, though, that\n normal tasks *can* be scheduled in the future using Cloud Tasks.\n- [Namespacing](/appengine/docs/standard/python/taskqueue/push/creating-tasks#working_with_tasks_in_a_multi-tenant_application):\n\n Some of the runtimes that use the App Engine SDK have APIs that\n support task multitenancy through namespacing. This feature is not\n available in Cloud Tasks.\n- [Local emulator](/appengine/docs/standard/python/tools/using-local-server):\n\n The local development server provided by the gcloud CLI or the App Engine SDK\n does not support simulated endpoints for Cloud Tasks API calls.\n- [Asynchronous task add](/appengine/docs/standard/python/taskqueue/push/creating-tasks#adding_tasks_asynchronously):\n\n Users of the App Engine SDK can choose to add tasks to queues asynchronously.\n This feature is not available in Cloud Tasks.\n\n### For more information\n\nMore detailed guides for migrating your code can be found in the App Engine Task Queue\ndocumentation set:\n\n- Migrating from Python 2.7 [pull queues](/appengine/docs/standard/python/taskqueue/pull/migrating-pull-queues) to Pub/Sub\n- Migrating from Python 2.7 [push queues](/appengine/docs/standard/python/taskqueue/push/migrating-push-queues) to Cloud Tasks\n- Migrating from Java 8 [pull queues](/appengine/docs/standard/java/taskqueue/pull/migrating-pull-queues) to Pub/Sub\n- Migrating from Java 8 [push queues](/appengine/docs/standard/java/taskqueue/push/migrating-push-queues) to Cloud Tasks"]]