Skip to content

CreateDrizzleJobQueueOptions

Defined in: packages/messaging/src/adapters/cloudflare/index.ts:197

Options of the queues that lease the jobs dequeue() returns.

T = unknown

optional close?: () => void | Promise<void>

Defined in: packages/messaging/src/adapters/cloudflare/sql-client.ts:51

void | Promise<void>

CreateDrizzleSqlClientOptions.close


db: DrizzleSqlDatabaseLike

Defined in: packages/messaging/src/adapters/cloudflare/sql-client.ts:39

CreateDrizzleSqlClientOptions.db


dialect: SqlDialect

Defined in: packages/messaging/src/adapters/cloudflare/sql-client.ts:38

CreateDrizzleSqlClientOptions.dialect


optional indexNames?: Partial<JobQueueIndexNames>

Defined in: packages/messaging/src/adapters/cloudflare/index.ts:201


optional initializeSchema?: boolean

Defined in: packages/messaging/src/adapters/cloudflare/index.ts:207

Whether the queue creates its table and indexes on first use. Set it to false when migrations create the schema.

true

optional leaseMs?: number

Defined in: packages/messaging/src/queue/job-queue.interface.ts:64

How long a dequeued job may stay processing before it is due again (default: Infinity, no lease). If it is neither completed nor failed by then, for example because the worker stopped mid-job, the next dequeue() counts the lost attempt as failed (error: "LEASE_EXPIRED") and makes the job due again, or fails it when no attempts are left. Set it above the longest time a job can take: a lease is not renewed, and a worker that outlives it can still complete or fail the job while another worker has it. dequeue() leaves the jobs its caller names as still running alone, which is how JobProcessor keeps a job it is still running from being run again or counted as lost.

JobLeaseOptions.leaseMs


optional mapTransactionDb?: (value) => DrizzleSqlDatabaseLike

Defined in: packages/messaging/src/adapters/cloudflare/sql-client.ts:50

unknown

DrizzleSqlDatabaseLike

CreateDrizzleSqlClientOptions.mapTransactionDb


optional normalizeResult?: <T>(input) => CloudflareSqlQueryResult<T>

Defined in: packages/messaging/src/adapters/cloudflare/sql-client.ts:45

T = Record<string, unknown>

readonly unknown[]

unknown

string

CloudflareSqlQueryResult<T>

CreateDrizzleSqlClientOptions.normalizeResult


optional onLeaseExpired?: (job) => void | Promise<void>

Defined in: packages/messaging/src/queue/job-queue.interface.ts:72

Called by dequeue() for each job whose lease had expired, once the job is stored pending again or, with no attempts left, failed. dequeue() waits for it before it leases the job it returns, which may be the same one, so it does not shorten that lease. What it throws is logged and does not stop the dequeue.

Job

void | Promise<void>

JobLeaseOptions.onLeaseExpired


optional renderQuery?: (input) => unknown

Defined in: packages/messaging/src/adapters/cloudflare/sql-client.ts:40

SqlDialect

readonly unknown[]

string

unknown

CreateDrizzleSqlClientOptions.renderQuery


optional tableName?: string

Defined in: packages/messaging/src/adapters/cloudflare/index.ts:200