Docs

Overview

Queue provides at-least-once message delivery between producers and consumers. Send JSON or text messages, receive them in batches, and acknowledge when processing is complete. Unacknowledged messages are automatically re-delivered.

Platform Mapping

PlatformBacking ServiceProvisioned by
AWSAmazon SQS (Standard)Alien
GCPGoogle Cloud Pub/SubAlien
AzureAzure Service BusAlien
Kubernetes / On-PremExternal (SQS, Kafka, Redis Streams)Cluster operator
LocalSQLite (embedded database)Alien

On Kubernetes / on-prem, Queue is not provisioned by Alien. The cluster operator provides the messaging service and configures it via Helm values.

When to Use

Use Queue for decoupling producers from consumers — task queues, event pipelines, background job processing, webhook relay.

Don't use Queue for request-response patterns (use Worker invocation) or for ordered event streams (Queue does not guarantee ordering).

Stack Definition

Declare a Queue resource in your alien.ts:

const tasks = new alien.Queue("tasks").build()
ParameterTypeDescription
idstringResource identifier. [A-Za-z0-9-_], max 64 characters.

Queue has no additional configuration options. The backing service (SQS, Pub/Sub, Service Bus) is determined by the deployment platform.

Quick Start

import { queue } from "@alienplatform/sdk"
const tasks = queue("tasks")  // bind the queue once by name

// The handle is bound to the queue; send() JSON-serializes the message
await tasks.send({ type: "process-image", imageId: "123" })

const messages = await tasks.receive(10)
for (const msg of messages) {
  await processTask(msg.payloadType === "json" ? JSON.parse(msg.payload) : msg.payload)
  await tasks.ack(msg.receiptHandle)
}

Triggers

Queues can automatically trigger workers — one message per invocation:

// alien.ts
const worker = new alien.Worker("worker")
  .trigger(tasks)
  .build()
// worker code
import { onQueueMessage } from "@alienplatform/sdk"

onQueueMessage("tasks", async (message) => {
  await processTask(message.payload)
  // auto-acknowledged on success
})

See Behavior & Limits for trigger support per platform.

On this page