API reference
queue(options) creates a Layeron Queue module for durable async delivery, retries, consumers, and dead letters.
Import
Section titled “Import”import { queue } from "@layeron/modules"Create a Layeron queue module.
queue(options: QueueModuleOptions): QueueModuleQueueRetryOptions
Section titled “QueueRetryOptions”Retry policy for a Layeron queue.
| Field | Type | Description |
|---|---|---|
maxAttempts | int32 | undefined | Maximum delivery attempts before the message moves to dead letters. |
backoff | QueueBackoffMode | undefined | Backoff algorithm between failed attempts. |
initialDelaySeconds | int32 | undefined | First retry delay in seconds. |
maxDelaySeconds | int32 | undefined | Maximum retry delay in seconds. |
QueueRetentionOptions
Section titled “QueueRetentionOptions”Message retention policy for queue storage.
| Field | Type | Description |
|---|---|---|
days | int32 | undefined | Days to retain queue messages. |
QueueDeadLetterOptions
Section titled “QueueDeadLetterOptions”Dead letter policy for messages that exhaust retry attempts.
| Field | Type | Description |
|---|---|---|
name | string | Stable dead letter stream name. |
retentionDays | int32 | undefined | Days to retain dead letter records. |
QueueConsumerOptions
Section titled “QueueConsumerOptions”Consumer lease and batch policy.
| Field | Type | Description |
|---|---|---|
name | string | undefined | Stable consumer name. |
batchSize | int32 | undefined | Maximum messages leased per drain call. |
concurrency | int32 | undefined | Maximum concurrent handler executions for this consumer. |
visibilityTimeoutSeconds | int32 | undefined | Seconds before a leased message becomes available again. |
QueueModuleOptions
Section titled “QueueModuleOptions”Options accepted by queue(options).
| Field | Type | Description |
|---|---|---|
name | string | Stable queue name inside the Layeron app. |
namespace | string | undefined | Platform namespace for the instance. Defaults to default. |
retry | QueueRetryOptions | undefined | Retry policy for failed deliveries. |
retention | QueueRetentionOptions | undefined | Retention policy for queue messages. |
deadLetter | QueueDeadLetterOptions | undefined | Dead letter policy for exhausted messages. |
consumer | QueueConsumerOptions | undefined | Consumer lease and batch policy. |
observability | Layeron.Observability.ObservabilityConfig | undefined | Observability settings for queue delivery, retries, drains, and dead letters. |
QueueModule
Section titled “QueueModule”Normalized Layeron queue module.
| Field | Type | Description |
|---|---|---|
name | ”queue” | Module name. |
config | QueueModuleOptions | Normalized module configuration. |
observability | Layeron.Observability.ObservabilityConfig | undefined | Effective observability policy recorded on the module declaration. |
QueueSendOptions
Section titled “QueueSendOptions”Send options for one message.
| Field | Type | Description |
|---|---|---|
idempotencyKey | string | undefined | Application idempotency key used to dedupe sends. |
delaySeconds | int32 | undefined | Delay in seconds before the message becomes visible. |
deliverAt | string | undefined | RFC3339 time when the message becomes visible. |
headers | Record<unknown> | undefined | Small structured metadata stored with the message. |
QueueSendResult
Section titled “QueueSendResult”Result returned after a message is accepted.
| Field | Type | Description |
|---|---|---|
messageId | string | Layeron message id. |
deduped | boolean | undefined | True when idempotency reused an existing accepted message. |
QueueBackoffMode
Section titled “QueueBackoffMode”Retry backoff mode for queue delivery attempts.
| Value | Description |
|---|---|
fixed | Use the same retry delay for each failed delivery attempt. |
exponential | Increase retry delay after each failed delivery attempt. |
Operations
Section titled “Operations”queueSend
Section titled “queueSend”Send one message.
queueSend(payload: unknown, options?: QueueSendOptions): QueueSendResult