Skip to content
pushqdocs
Get started

pushq keeps Cloud Tasks’ delivery semantics: rate limits with token-bucket bursts, the same retry backoff math, pause/resume/purge, named-task deduplication and at-least-once HTTP push delivery. Most migrations are a mechanical rename of fields and calls.

Use this guide when you have code that uses a google-cloud-tasks client library or the Cloud Tasks REST API with HTTP targets, and you want to run the same workload on pushq, hosted or self-hosted.

Cloud Tasks pushq
Project / location / queue path A queue name: [a-z0-9-] segments joined by / for folders (e.g. billing/invoices), up to 200 characters
CreateQueue / UpdateQueue PUT /v1/queues/{queue}: one idempotent upsert, cheap enough to call before every enqueue
rateLimits.maxDispatchesPerSecond rate_limits.max_dispatches_per_second
rateLimits.maxBurstSize rate_limits.max_burst_size (0 = automatic, like Cloud Tasks)
rateLimits.maxConcurrentDispatches rate_limits.max_concurrent_dispatches
retryConfig.maxAttempts retry.max_attempts (-1 = unlimited)
retryConfig.maxRetryDuration retry.max_retry_duration_seconds (0 = unlimited)
retryConfig.minBackoff / maxBackoff retry.min_backoff_seconds / retry.max_backoff_seconds
retryConfig.maxDoublings retry.max_doublings (same doubling-then-linear schedule)
PauseQueue / ResumeQueue / PurgeQueue POST /v1/queues/{queue}:pause, :resume, :purge
DeleteQueue DELETE /v1/queues/{queue}. The name can be reused immediately (Cloud Tasks blocks reuse for days).
CreateTask with task.name POST /v1/queues/{queue}/tasks with task_id ([A-Za-z0-9_-], up to 500 characters). Reusing an ID within the dedup window (default 1h) returns 409 already_exists.
httpRequest.url url, or path resolved against the queue’s target.base_url
httpRequest.httpMethod method (default POST), or target.method to override it for the whole queue
httpRequest.headers / body headers / body_base64, or json_body for JSON payloads (no manual encoding; sets Content-Type: application/json)
scheduleTime schedule_time, or delay_seconds
dispatchDeadline dispatch_deadline_seconds (same 15s to 30m range, default 10m)
RunTask POST /v1/queues/{queue}/tasks/{id}:run (also bypasses rate limits and the paused state)
ListTasks / GetTask / DeleteTask The same, plus state and id_prefix filters and cursor pagination
OIDC / OAuth tokens on delivery Static headers (target.headers) or Standard Webhooks HMAC signing (target.signing_secret). See authenticate deliveries without OIDC tokens.
X-CloudTasks-QueueName, X-CloudTasks-TaskName, … X-Pushq-Queue, X-Pushq-Task-Id, X-Pushq-Attempt, X-Pushq-Execution-Count, X-Pushq-Scheduled-Time
App Engine targets, pull queues, BufferTask Not supported. pushq delivers HTTP push only.

Parameter names in this guide are the JSON field names. The SDKs use their language’s casing: camelCase in TypeScript and Java, snake_case in Python, PascalCase in Go and .NET.

  • Per-task retry overrides. Set retry on a task to override any part of the queue’s retry config for that task. In the Cloud Tasks Python client, client.create_task(..., retry=Retry(...)) is a retry policy for the enqueue RPC itself, not for delivery, which is a common source of silent misconfiguration. In pushq, retry on a task controls delivery retries.
  • Many queues. Cloud Tasks limits queues per region. A self-hosted pushq server has no queue cap and is designed for 10,000+ dynamic queues, for example one per tenant. On the hosted service, the number of queues depends on your plan.
  • Dead-letter queues. Set dead_letter_queue on a queue and tasks that exhaust their retries are copied there. See dead-letter queues.
  • Stats API. GET /v1/queues/{queue}/stats?id_prefix= returns depth by state, the age of the oldest due task and recent error counts, without listing tasks.
  • Batch enqueue. POST /v1/queues/{queue}/tasks:batch takes up to 500 tasks; each succeeds or fails on its own.
  • Retained history. Finished tasks and their full attempt history are kept for a configurable time (default 24h for succeeded, 7 days for failed).
  • Longer schedules. Tasks can be scheduled up to a year ahead by default (Cloud Tasks: 30 days); self-hosters can change the limit.
  • Backoff schedule. The retry interval starts at min_backoff_seconds, doubles max_doublings times, then grows linearly by 2^max_doublings × min_backoff_seconds per retry, capped at max_backoff_seconds. For example, min 10s, max 300s, 3 doublings gives 10, 20, 40, 80, 160, 240, 300, 300, …
  • The both-limits rule. When max_attempts and max_retry_duration_seconds are both set, a task keeps retrying until both are reached, exactly like Cloud Tasks. If either is unlimited, the other one alone decides.
  • What counts as success. Any 2xx response. Anything else, or no response before dispatch_deadline_seconds, is a failed attempt. A 429 or 503 with a Retry-After header also briefly cools the whole queue down.
  • At-least-once delivery. Make handlers idempotent. With signing on, the webhook-id header (queue/task_id) is stable across retries; use it as an idempotency key.
  • Run and pause. :run works on paused queues and bypasses rate limits. A disabled queue refuses new tasks and :run.

See retries and backoff and how delivery works for the details.

The example creates or updates a queue named account-42 limited to 10 deliveries per second, then enqueues a JSON task for /hooks/send in one hour, deduplicated by ID, with at most 3 attempts.

import { CloudTasksClient } from "@google-cloud/tasks";
const client = new CloudTasksClient();
const parent = client.queuePath(project, location, "account-42");
await client.createTask({
parent,
task: {
name: `${parent}/tasks/follow-up-${uid}`,
scheduleTime: { seconds: Math.floor(Date.now() / 1000) + 3600 },
httpRequest: {
httpMethod: "POST",
url: `${baseUrl}/hooks/send`,
headers: { "Content-Type": "application/json", "x-internal-key": KEY },
body: Buffer.from(JSON.stringify(payload)).toString("base64"),
},
},
});

The queue upsert replaces the separate create/update-queue step. It’s idempotent, so you can call it at startup or before enqueueing. The SDK clients default to the hosted API; when self-hosting, pass your server’s URL (see Install & configure an SDK).

import { Pushq } from "pushq";
const pq = new Pushq({ apiKey: process.env.PUSHQ_API_KEY });
await pq.upsertQueue("account-42", {
rateLimits: { maxDispatchesPerSecond: 10 },
target: { baseUrl, headers: { "x-internal-key": KEY } }, // or signingSecret: "whsec_..."
});
await pq.createTask("account-42", {
path: "/hooks/send",
jsonBody: payload,
delaySeconds: 3600,
taskId: `follow-up-${uid}`,
retry: { maxAttempts: 3 },
});

What changed:

  • The queue path becomes a plain name. If you encoded the project or region in the path to separate tenants, use folders instead: tenant-42/emails.
  • The receiver’s base URL and shared headers move to the queue (target), so each task only carries a path.
  • json_body replaces hand-encoded bytes or base64.
  • The task name becomes task_id. Duplicate IDs fail with 409 already_exists; treat that as “already enqueued”. See the already_exists error.
  • retry on the task controls delivery retries for that task.

Your HTTP handlers keep working. Update anything that reads Cloud Tasks headers:

Cloud Tasks header pushq header
X-CloudTasks-QueueName X-Pushq-Queue
X-CloudTasks-TaskName X-Pushq-Task-Id
X-CloudTasks-TaskRetryCount X-Pushq-Attempt (1-based: the first delivery is 1)
X-CloudTasks-TaskExecutionCount X-Pushq-Execution-Count (attempts that got a response)
X-CloudTasks-TaskETA X-Pushq-Scheduled-Time (RFC 3339)

Cloud Tasks’ retry count starts at 0; pushq’s attempt number starts at 1.

Authenticate deliveries without OIDC tokens

Section titled “Authenticate deliveries without OIDC tokens”

Cloud Tasks can attach a Google-signed OIDC or OAuth token to each request. pushq doesn’t issue Google tokens. Use one or both of these instead:

  1. Static headers. Set target.headers on the queue, for example {"x-internal-key": "..."}. pushq adds them to every delivery and they override task headers with the same name. Use this as a drop-in for an internal shared-secret header.
  2. Signing (recommended). Set target.signing_secret (e.g. whsec_...) on the queue. Each delivery then carries Standard Webhooks headers (webhook-id, webhook-timestamp, webhook-signature). Verify them with any Standard Webhooks library or with the verify-signature helper in every pushq SDK, which checks the HMAC in constant time and rejects stale timestamps to stop replays.

Upserting a queue without target.signing_secret keeps the stored secret; send an empty string to clear it. See webhook signature verification for examples in every language.

If your receiver sits behind something that only accepts Google identity tokens (for example a Cloud Run service with IAM authentication), allow unauthenticated invocations and verify the pushq signature in your handler instead.

  1. Create the queues in pushq with the same rate limits and retry config. Call the upsert from your deploy or startup code so the config lives in your repository.
  2. Point your receivers’ header parsing at the X-Pushq-* headers, and add signature verification if you use signing.
  3. Switch producers to the pushq SDK. New tasks now go to pushq.
  4. Let the Cloud Tasks queues drain, then pause and delete them.

Tasks already in Cloud Tasks stay there; there’s no import. If a task must not run twice during the switch, keep its ID the same in both systems and make the handler idempotent on it.

pushq dev runs a full queue on your machine (SQLite, no auth, fast timers), so delays, retries and rate limits behave as in production instead of being faked with synchronous calls. See local development.