En esta página, se muestra cómo crear tareas de App Engine de manera programática
y colócalos en colas de Cloud Tasks.
Con este proceso puedes especificar de forma explícita el servicio y el controlador que
debe procesar la tarea y, opcionalmente, pasar datos específicos de la tarea al
controlador. El servicio de Cloud Tasks reenvía la solicitud de tarea a
pero este trabajador está ubicado en App Engine. Entonces, todas las colas
que se orientan a controladores de App Engine deben tener un
App de App Engine.
Los controladores deben ejecutarse en la región en la que
La aplicación de App Engine se ejecuta. Esta región también es el
Parámetro LOCATION_ID
para tus Cloud Tasks
solicitudes. Para obtener más información, consulta
Colas de Cloud Tasks con destinos de App Engine.
También puedes ajustar la configuración para la tarea, como programar un momento en el futuro en que debe ejecutarse o Limitar la cantidad de veces que quieres que se reintente la tarea si falla. Si elegiste especificar un nombre para tarea, Cloud Tasks puede usar ese nombre para garantizar la anulación de duplicación de tareas aunque el procesamiento necesario puede aumentar la latencia.
Reglas de firewall de App Engine
En el entorno estándar de App Engine, el firewall de App Engine puede permitir que determinado tráfico interno omita el firewall. Esto significa que si estableces la regla default
en
deny
, las solicitudes de ciertos servicios destinados al entorno estándar de App Engine no
bloquearse. Todos son tipos de tráfico solicitados en la configuración de la app o enviados desde la misma app. Las solicitudes que omiten las reglas de firewall de esta manera también incluyen tareas de App Engine en Cloud Tasks (incluidas las listas de tareas en cola de App Engine).
Para permitir solicitudes entrantes, estos son los rangos de IP de App Engine en Cloud Tasks (incluidas las listas de tareas en cola de App Engine):
Rango de IP para las solicitudes enviadas al entorno estándar de App Engine:
0.1.0.2/32
(evita el regla de firewall predeterminada si está configurada para rechazarla)Rango de IP para solicitudes enviadas al entorno flexible de App Engine:
0.1.0.2/32
Crea tareas con las bibliotecas cliente
Las tareas se crean como un Solicitud HTTP, que puedes construir como quieras. Con el bibliotecas cliente, como se muestra a continuación de las muestras pueden ayudarte a administrar los detalles de la comunicación de bajo nivel con el del servidor, incluida la autenticación con Google. Para agregar una tarea a una cola, consulta Agrega una tarea a una cola de Cloud Tasks
C#
Go
Java
Ten en cuenta el archivo pom.xml
:
Node.js
Ten en cuenta el archivo package.json
:
PHP
Ten en cuenta el archivo composer.json
:
Python
Ten en cuenta el archivo requirements.txt
:
Ruby
¿Qué sigue?
- Obtén más información sobre cómo crear controladores de tareas de App Engine.
- Obtén más información sobre las tareas en la Referencia de la API de RPC.
- Obtén más información sobre las tareas en la referencia de la API de REST.