IJob
in
Interface IJob
Represents a job to be executed.
Table of Contents
Methods
- Add() : bool
- Adds the job.
- Begin() : bool
- Begins a transaction.
- Commit() : bool
- Commits a transaction.
- Delete() : bool
- Deletes the job.
- Fail() : bool
- Marks the job as failed.
- Handle() : bool
- Handles the job.
- IsLastAttempt() : bool
- Checks if the current attempt is the last attempt.
- IsParallel() : bool
- Checks if the job can be executed in parallel.
- Rollback() : bool
- Rolls back a transaction.
- SetHeaders() : void
- Add headers to job manager
- ToArray() : array<string|int, mixed>
- Converts the job to an array.
- Update() : bool
- Updates the job.
Methods
Add()
Adds the job.
public
Add() : bool
Return values
bool —True if the job is successfully added, false otherwise.
Begin()
Begins a transaction.
public
Begin() : bool
Return values
bool —True if the transaction is successfully begun, false otherwise.
Commit()
Commits a transaction.
public
Commit(array<string|int, mixed>|object $result) : bool
Parameters
- $result : array<string|int, mixed>|object
-
The result of the transaction.
Return values
bool —True if the transaction is successfully committed, false otherwise.
Delete()
Deletes the job.
public
Delete() : bool
Return values
bool —True if the job is successfully deleted, false otherwise.
Fail()
Marks the job as failed.
public
Fail(Throwable $exception[, bool $isLastAttempt = false ]) : bool
Parameters
- $exception : Throwable
-
The exception that caused the failure.
- $isLastAttempt : bool = false
-
Indicates if the failure is occurring on the last attempt.
Return values
bool —True if the job is marked as failed, false otherwise.
Handle()
Handles the job.
public
Handle(Logger $logger) : bool
Parameters
- $logger : Logger
-
The logger instance to use for logging.
Return values
bool —True if the job is handled successfully, false otherwise.
IsLastAttempt()
Checks if the current attempt is the last attempt.
public
IsLastAttempt() : bool
Return values
bool —True if the current attempt is the last attempt, false otherwise.
IsParallel()
Checks if the job can be executed in parallel.
public
IsParallel() : bool
Return values
bool —True if the job can be executed in parallel, false otherwise.
Rollback()
Rolls back a transaction.
public
Rollback() : bool
Return values
bool —True if the transaction is successfully rolled back, false otherwise.
SetHeaders()
Add headers to job manager
public
SetHeaders() : void
ToArray()
Converts the job to an array.
public
ToArray([bool $dummy = false ][, Closure|null $callback = null ]) : array<string|int, mixed>
Parameters
- $dummy : bool = false
-
Indicates if dummy data should be included in the array.
- $callback : Closure|null = null
-
An optional callback function to manipulate the array.
Return values
array<string|int, mixed> —The array representation of the job.
Update()
Updates the job.
public
Update() : bool
Return values
bool —True if the job is successfully updated, false otherwise.