Interface: QueueInterface
Full name: Azera\Queue\QueueInterface
Interface for queue backends.
Implementations push jobs onto a backend (Redis, AMQP, DB, in-process) and provide the mechanics for a worker to pop and acknowledge them.
The core ships with SyncQueue, which processes jobs immediately
in the current process. Real async backends live in the
sailantis/azera-queue companion package.
Public methods
push() ·
public function push(Azera\Queue\JobInterface $job, array $options = []): mixed
Push a job onto the queue.
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$job |
JobInterface | - | The job to enqueue. |
$options |
array | [] |
Backend-specific options (delay, priority, queue override, etc.). |
Return value
- Type:
mixed - Description: The job identifier or result. For
SyncQueue
this is null (job ran synchronously).
Throws
- QueueException On failure to enqueue.
registerWorker() ·
public function registerWorker(string $jobClass, callable|null $handler = null): void
Register a worker callback for a specific job class.
For async backends, this is used by the worker process to map
serialized jobs back to their handlers. For SyncQueue,
this is a no-op (jobs handle themselves).
Parameters
| Name | Type | Default | Description |
|---|---|---|---|
$jobClass |
string | - | The job class to register. |
$handler |
callable|null | null |
Optional explicit handler. |
Return value
- Type:
void