Migrate from Google Cloud Tasks
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 to pushq concept map
Section titled “Cloud Tasks to pushq concept map”| 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.
What pushq adds over Cloud Tasks
Section titled “What pushq adds over Cloud Tasks”- Per-task retry overrides. Set
retryon 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,retryon 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_queueon 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:batchtakes 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.
Cloud Tasks semantics pushq keeps
Section titled “Cloud Tasks semantics pushq keeps”- Backoff schedule. The retry interval starts at
min_backoff_seconds, doublesmax_doublingstimes, then grows linearly by2^max_doublings × min_backoff_secondsper retry, capped atmax_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_attemptsandmax_retry_duration_secondsare 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. A429or503with aRetry-Afterheader also briefly cools the whole queue down. - At-least-once delivery. Make handlers idempotent. With signing on, the
webhook-idheader (queue/task_id) is stable across retries; use it as an idempotency key. - Run and pause.
:runworks on paused queues and bypasses rate limits. Adisabledqueue refuses new tasks and:run.
See retries and backoff and how delivery works for the details.
Migrate your client code
Section titled “Migrate your client code”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.
Before: Google Cloud Tasks client
Section titled “Before: Google Cloud Tasks client”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"), }, },});import json, timefrom google.cloud import tasks_v2from google.protobuf import timestamp_pb2
client = tasks_v2.CloudTasksClient()parent = client.queue_path(project, location, "account-42")
client.create_task(parent=parent, task={ "name": f"{parent}/tasks/follow-up-{uid}", "schedule_time": timestamp_pb2.Timestamp(seconds=int(time.time() + 3600)), "http_request": { "http_method": tasks_v2.HttpMethod.POST, "url": f"{base_url}/hooks/send", "headers": {"Content-Type": "application/json", "x-internal-key": KEY}, "body": json.dumps(payload).encode(), },})import ( cloudtasks "cloud.google.com/go/cloudtasks/apiv2" "cloud.google.com/go/cloudtasks/apiv2/cloudtaskspb" "google.golang.org/protobuf/types/known/timestamppb")
client, err := cloudtasks.NewClient(ctx)if err != nil { return err}defer client.Close()
parent := fmt.Sprintf("projects/%s/locations/%s/queues/account-42", project, location)body, _ := json.Marshal(payload)
_, err = client.CreateTask(ctx, &cloudtaskspb.CreateTaskRequest{ Parent: parent, Task: &cloudtaskspb.Task{ Name: parent + "/tasks/follow-up-" + uid, ScheduleTime: timestamppb.New(time.Now().Add(time.Hour)), MessageType: &cloudtaskspb.Task_HttpRequest{ HttpRequest: &cloudtaskspb.HttpRequest{ HttpMethod: cloudtaskspb.HttpMethod_POST, Url: baseURL + "/hooks/send", Headers: map[string]string{"Content-Type": "application/json", "x-internal-key": key}, Body: body, }, }, },})import com.google.cloud.tasks.v2.*;import com.google.protobuf.ByteString;import com.google.protobuf.Timestamp;
try (CloudTasksClient client = CloudTasksClient.create()) { String parent = QueueName.of(project, location, "account-42").toString(); Task task = Task.newBuilder() .setName(TaskName.of(project, location, "account-42", "follow-up-" + uid).toString()) .setScheduleTime(Timestamp.newBuilder() .setSeconds(Instant.now().plusSeconds(3600).getEpochSecond())) .setHttpRequest(HttpRequest.newBuilder() .setHttpMethod(HttpMethod.POST) .setUrl(baseUrl + "/hooks/send") .putHeaders("Content-Type", "application/json") .putHeaders("x-internal-key", key) .setBody(ByteString.copyFromUtf8(payloadJson))) .build(); client.createTask(parent, task);}using Google.Cloud.Tasks.V2;using Google.Protobuf;using Google.Protobuf.WellKnownTypes;
var client = await CloudTasksClient.CreateAsync();
await client.CreateTaskAsync(new CreateTaskRequest{ ParentAsQueueName = new QueueName(project, location, "account-42"), Task = new Google.Cloud.Tasks.V2.Task { TaskName = new TaskName(project, location, "account-42", $"follow-up-{uid}"), ScheduleTime = Timestamp.FromDateTime(DateTime.UtcNow.AddHours(1)), HttpRequest = new HttpRequest { HttpMethod = HttpMethod.Post, Url = $"{baseUrl}/hooks/send", Headers = { ["Content-Type"] = "application/json", ["x-internal-key"] = key }, Body = ByteString.CopyFromUtf8(payloadJson), }, },});curl -X POST "https://cloudtasks.googleapis.com/v2/projects/$PROJECT/locations/$LOCATION/queues/account-42/tasks" \ -H "Authorization: Bearer $(gcloud auth print-access-token)" \ -H "Content-Type: application/json" \ -d '{ "task": { "name": "projects/'"$PROJECT"'/locations/'"$LOCATION"'/queues/account-42/tasks/follow-up-123", "scheduleTime": "2026-12-01T17:00:00Z", "httpRequest": { "httpMethod": "POST", "url": "https://app.example.com/hooks/send", "headers": {"Content-Type": "application/json", "x-internal-key": "change-me"}, "body": "eyJ0byI6ImFAZXhhbXBsZS5jb20ifQ==" } } }'After: pushq SDK
Section titled “After: pushq SDK”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 },});import osfrom pushq import Pushq, RateLimits, Retry, Target
pq = Pushq(api_key=os.environ["PUSHQ_API_KEY"])
pq.upsert_queue( "account-42", rate_limits=RateLimits(max_dispatches_per_second=10), target=Target(base_url=base_url, headers={"x-internal-key": KEY}), # or signing_secret="whsec_...")
pq.create_task( "account-42", path="/hooks/send", json_body=payload, delay_seconds=3600, task_id=f"follow-up-{uid}", retry=Retry(max_attempts=3),)import pushq "github.com/blissfulrays/pushq/sdks/go"
pq := pushq.New("", os.Getenv("PUSHQ_API_KEY")) // "" = hosted API
_, err := pq.UpsertQueue(ctx, "account-42", pushq.QueueConfig{ RateLimits: &pushq.RateLimits{MaxDispatchesPerSecond: pushq.Float64(10)}, Target: &pushq.Target{ BaseURL: baseURL, Headers: map[string]string{"x-internal-key": key}, // or SigningSecret: "whsec_..." },})if err != nil { return err}
_, err = pq.CreateTask(ctx, "account-42", pushq.TaskCreate{ Path: "/hooks/send", JSONBody: payload, DelaySeconds: pushq.Float64(3600), TaskID: "follow-up-" + uid, Retry: &pushq.Retry{MaxAttempts: pushq.Int(3)},})import io.pushq.*;
Pushq pq = Pushq.builder().apiKey(System.getenv("PUSHQ_API_KEY")).build();
pq.upsertQueue("account-42", QueueConfig.builder() .rateLimits(RateLimits.builder().maxDispatchesPerSecond(10).build()) .target(Target.builder() .baseUrl(baseUrl) .header("x-internal-key", key) // or .signingSecret("whsec_...") .build()) .build());
pq.createTask("account-42", TaskCreate.builder() .path("/hooks/send") .jsonBody(payload) .delaySeconds(3600) .taskId("follow-up-" + uid) .retry(RetryConfig.builder().maxAttempts(3).build()) .build());using Pushq;
var pq = new PushqClient(apiKey: Environment.GetEnvironmentVariable("PUSHQ_API_KEY"));
await pq.UpsertQueueAsync("account-42", new QueueConfig{ RateLimits = new RateLimits { MaxDispatchesPerSecond = 10 }, Target = new Target { BaseUrl = baseUrl, Headers = new Dictionary<string, string> { ["x-internal-key"] = key }, // or SigningSecret = "whsec_..." },});
await pq.CreateTaskAsync("account-42", new TaskCreate{ Path = "/hooks/send", JsonBody = payload, Delay = TimeSpan.FromHours(1), TaskId = $"follow-up-{uid}", Retry = new RetryConfig { MaxAttempts = 3 },});curl -X PUT https://api.pushqueue.dev/v1/queues/account-42 \ -H "Authorization: Bearer $PUSHQ_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "rate_limits": {"max_dispatches_per_second": 10}, "target": {"base_url": "https://app.example.com", "headers": {"x-internal-key": "change-me"}} }'
curl -X POST https://api.pushqueue.dev/v1/queues/account-42/tasks \ -H "Authorization: Bearer $PUSHQ_API_KEY" \ -H "Content-Type: application/json" \ -d '{ "path": "/hooks/send", "json_body": {"to": "a@example.com"}, "delay_seconds": 3600, "task_id": "follow-up-123", "retry": {"max_attempts": 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 apath. json_bodyreplaces hand-encoded bytes or base64.- The task name becomes
task_id. Duplicate IDs fail with409 already_exists; treat that as “already enqueued”. See the already_exists error. retryon the task controls delivery retries for that task.
Update your task handlers
Section titled “Update your task handlers”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:
- Static headers. Set
target.headerson 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. - 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.
Migration checklist
Section titled “Migration checklist”- 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.
- Point your receivers’ header parsing at the
X-Pushq-*headers, and add signature verification if you use signing. - Switch producers to the pushq SDK. New tasks now go to pushq.
- 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.
Test the migration locally
Section titled “Test the migration locally”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.
Read more
Section titled “Read more”- Queues: rate limits, targets and folders.
- Tasks: scheduling, deduplication and per-task retries.
- Rate limits: token buckets and concurrency caps.
- Install & configure an SDK: TypeScript, Python, Go, Java and .NET.
- REST API overview: every endpoint.