QueueJobContext
in package
Context object passed to job handlers for progress reporting and logging.
Table of Contents
Methods
- __construct() : mixed
- batchId() : int|null
- Get the batch ID (null if not part of a batch).
- isCancelled() : bool
- Check if the job has been cancelled (cooperative cancellation).
- jobId() : int
- Get the current job ID.
- log() : void
- Log an event against this job.
- progress() : void
- Update job progress.
Methods
__construct()
public
__construct(int $jobId, int|null $batchId, QueueService $queueService) : mixed
Parameters
- $jobId : int
- $batchId : int|null
- $queueService : QueueService
batchId()
Get the batch ID (null if not part of a batch).
public
batchId() : int|null
Return values
int|nullisCancelled()
Check if the job has been cancelled (cooperative cancellation).
public
isCancelled() : bool
Return values
booljobId()
Get the current job ID.
public
jobId() : int
Return values
intlog()
Log an event against this job.
public
log(string $message[, array<string|int, mixed> $details = [] ]) : void
Parameters
- $message : string
- $details : array<string|int, mixed> = []
progress()
Update job progress.
public
progress(int $current, int $total[, string $message = '' ]) : void
Parameters
- $current : int
- $total : int
- $message : string = ''