Skip to content

GCP.CloudTasks reference

Source: src/GCP/CloudTasks/CreateTask.ts

Runtime binding for Cloud Tasks queues.tasks.create.

Bind this operation to a Queue in a Function/Action init phase. Provide CreateTaskHttp.

const createTask = yield* GCP.CloudTasks.CreateTask(queue);
yield* createTask({
body: {
task: {
httpRequest: {
url: "https://example.com/jobs",
httpMethod: "POST",
body: btoa(JSON.stringify({ id: "1" })),
},
},
},
});

Source: src/GCP/CloudTasks/CreateTaskHttp.ts Kind: Layer · Provides: GCP.CloudTasks.CreateTask

HTTP implementation of CreateTask.

Source: src/GCP/CloudTasks/Queue.ts

A Google Cloud Tasks queue.

Cloud Tasks queues have no labels, so Alchemy identifies its queues by the generated queueId: read reports a queue with an explicit queueId as unowned (adopt it with --adopt), and nuke cannot discover queues.

Changing queueId or location replaces the queue. Deleted queue names are tombstoned for up to 3 days — CreateQueue may appear to succeed; GetQueue is the source of truth.

Generated name

const queue = yield* GCP.CloudTasks.Queue("jobs", {});

Rate limits, retries, and logging

const queue = yield* GCP.CloudTasks.Queue("jobs", {
location: "us-central1",
rateLimits: {
maxDispatchesPerSecond: 10,
maxConcurrentDispatches: 5,
},
retryConfig: {
maxAttempts: 5,
minBackoff: "1s",
maxBackoff: "60s",
},
stackdriverLoggingConfig: { samplingRatio: 1 },
});

Paused queue

const queue = yield* GCP.CloudTasks.Queue("jobs", {
state: "PAUSED",
});