QueueApi

Reference for the QueueApi module: every class and function, with its full signature, parameters and return type. Exposes the Queue module's list and process handlers as API endpoints, served under the Queue API with shared-secret admin and worker tokens, so lock queues and task queues can be driven with no routing surface and no Cloud dependency.

This page is a pure reference. Including the module declares its endpoints into the ApiConfig registry at load, so a site only needs to call Api::Route(); the endpoints then appear in the API admin.

Classes
  • QueueApi - registers and serves the lock-queue list and process API endpoints.
  • QueueTaskApi - HTTP handlers for the task-queue type, served under the task path.

QueueApi

Registers the Queue module's API endpoints and serves the lock-queue handlers. Endpoints are served under /api/Queue/v1/... and authenticate with the shared Queue.QUEUE_ADMIN_TOKEN sent in the X-Queue-Admin-Token header.

Authenticate

QueueApi::Authenticate(): void

Shared-secret auth: the caller must send an X-Queue-Admin-Token header matching Queue.QUEUE_ADMIN_TOKEN. Throws an API error when the token is invalid or missing.

Returns void

Endpoints

QueueApi::Endpoints(): void

Register the Queue module's API endpoints into the ApiConfig registry, served under /api/Queue/v1/... Covers the lock-queue list and process endpoints and the task-queue worker and admin endpoints.

Returns void

List

QueueApi::List(): array

List every registered queue with its pending count. Serves GET /api/Queue/v1/list.

Returns array The poll interval and the list of queues.

Process

QueueApi::Process(object $request): array

Process a single item from the named queue. Serves POST /api/Queue/v1/process; the request body carries the queue name as "Module.queueName".

NameTypeDescription
$requestobjectThe request body, with a queue field naming the queue to process.

Returns array The remaining count of items in the queue.

QueueTaskApi

HTTP handlers for the task-queue type, served under /api/Queue/v1/task/... (routes registered by QueueApi::Endpoints()). Workers authenticate with the Queue.QUEUE_WORKER_TOKEN; the scheduler and worker manager authenticate with the Queue.QUEUE_ADMIN_TOKEN.

AuthenticateAdmin

QueueTaskApi::AuthenticateAdmin(): void

Verify the request carries a valid X-Queue-Admin-Token matching Queue.QUEUE_ADMIN_TOKEN. Throws an API error when the token is invalid or missing.

Returns void

AuthenticateWorker

QueueTaskApi::AuthenticateWorker(): void

Verify the request carries a valid X-Queue-Worker-Token matching Queue.QUEUE_WORKER_TOKEN. Throws an API error when the token is invalid or missing.

Returns void

Claim

QueueTaskApi::Claim(object $request): array

Lease the next task from the named queue for a worker. Serves POST Task/Worker/Claim; the body names the queue. Returns a null record id when nothing is pending.

NameTypeDescription
$requestobjectThe request body, with a queue field naming the queue.

Returns array The lease details and payload, or a null record id when the queue is empty.

Complete

QueueTaskApi::Complete(object $request): array

Record terminal success for a leased task, first worker wins. Serves POST Task/Worker/Complete; the body carries the queue, record id, worker reference and result.

NameTypeDescription
$requestobjectThe request body, with queue, recordId, workerRef and result fields.

Returns array Whether the result was accepted and whether this worker was first.

Fail

QueueTaskApi::Fail(object $request): array

Record terminal failure for a leased task. Serves POST Task/Worker/Fail; the body carries the queue, record id, worker reference and optional permanent flag and message.

NameTypeDescription
$requestobjectThe request body, with queue, recordId, workerRef and optional permanent and message fields.

Returns array Whether the failure was accepted.

ListQueues

QueueTaskApi::ListQueues(): array

Return per-queue demand metrics for the scheduler or worker manager. Serves GET Task/List, giving pending and in-flight counts and the oldest pending age per queue.

Returns array A list of per-queue metric entries.

Process

QueueTaskApi::Process(object $request): array

Run one queue's maintenance pass, reconciling leases and applying the overall timeout. Serves POST Task/Process; the body names the queue.

NameTypeDescription
$requestobjectThe request body, with a queue field naming the queue.

Returns array The result of the maintenance pass.

Progress

QueueTaskApi::Progress(object $request): array

Heartbeat a leased task, report progress and learn of cancellation. Serves POST Task/Worker/Progress; the body carries the queue, record id, worker reference and optional progress.

NameTypeDescription
$requestobjectThe request body, with queue, recordId, workerRef and optional progress fields.

Returns array The lease status, plus the renewed lease seconds when work should continue.