Neuron-PHP

SyncQueue
in package
implements IQueue

Synchronous queue implementation.

Executes jobs immediately without queueing. Useful for testing and local development.

Table of Contents

Interfaces

IQueue
Queue interface for managing job queues.

Methods

clear()  : int
Clear all jobs from the queue
clearFailedJobs()  : int
Clear all failed jobs
delete()  : void
Delete a job from the queue Called when a job completes successfully
failed()  : void
Mark a job as failed Moves the job to failed jobs storage
forgetFailedJob()  : bool
Delete a failed job
getFailedJobs()  : array<string|int, mixed>
Get all failed jobs
pop()  : QueuedJob|null
Pop the next available job from the queue
push()  : string
Push a job onto the queue
release()  : void
Release a job back to the queue Used when a job fails and should be retried
retryFailedJob()  : bool
Retry a failed job
size()  : int
Get the size of the queue

Methods

clear()

Clear all jobs from the queue

public clear([string $queue = 'default' ]) : int
Parameters
$queue : string = 'default'

Queue name (default: 'default')

Tags
inheritDoc

Always returns 0 since no jobs are queued

Return values
int

Number of jobs cleared

clearFailedJobs()

Clear all failed jobs

public clearFailedJobs() : int
Tags
inheritDoc

Always returns 0 since no jobs are stored

Return values
int

Number of failed jobs cleared

delete()

Delete a job from the queue Called when a job completes successfully

public delete(QueuedJob $job) : void
Parameters
$job : QueuedJob

Job to delete

Tags
inheritDoc

No-op since jobs execute immediately

failed()

Mark a job as failed Moves the job to failed jobs storage

public failed(QueuedJob $job, Throwable $exception) : void
Parameters
$job : QueuedJob

Failed job

$exception : Throwable

Exception that caused the failure

Tags
inheritDoc

Logs failure but doesn't store

forgetFailedJob()

Delete a failed job

public forgetFailedJob(string $id) : bool
Parameters
$id : string

Failed job ID

Tags
inheritDoc

Always returns false since no jobs are stored

Return values
bool

True if job was deleted, false if not found

getFailedJobs()

Get all failed jobs

public getFailedJobs() : array<string|int, mixed>
Tags
inheritDoc

Always returns empty array

Return values
array<string|int, mixed>

Array of failed job data

pop()

Pop the next available job from the queue

public pop([string $queue = 'default' ]) : QueuedJob|null
Parameters
$queue : string = 'default'

Queue name (default: 'default')

Tags
inheritDoc

Always returns null since jobs execute immediately

Return values
QueuedJob|null

The next job, or null if queue is empty

push()

Push a job onto the queue

public push(IJob $job[, array<string|int, mixed> $args = [] ][, string $queue = 'default' ][, int $delay = 0 ]) : string
Parameters
$job : IJob

Job instance to queue

$args : array<string|int, mixed> = []

Arguments to pass to the job

$queue : string = 'default'

Queue name (default: 'default')

$delay : int = 0

Delay in seconds before the job is available

Tags
inheritDoc

Executes job immediately instead of queueing

Return values
string

Job ID

release()

Release a job back to the queue Used when a job fails and should be retried

public release(QueuedJob $job[, int $delay = 0 ]) : void
Parameters
$job : QueuedJob

Job to release

$delay : int = 0

Delay in seconds before job is available again

Tags
inheritDoc

No-op since jobs execute immediately

retryFailedJob()

Retry a failed job

public retryFailedJob(string $id) : bool
Parameters
$id : string

Failed job ID

Tags
inheritDoc

Always returns false since no jobs are stored

Return values
bool

True if job was retried, false if not found

size()

Get the size of the queue

public size([string $queue = 'default' ]) : int
Parameters
$queue : string = 'default'

Queue name (default: 'default')

Tags
inheritDoc

Always returns 0 since jobs execute immediately

Return values
int

Number of jobs in the queue


        
On this page

Search results