class FakeJob extends Job

Traits

Properties

protected mixed $instance

The job handler instance.

from  Job
protected array|null $decodedPayload

The validated job payload.

from  Job
protected InvalidPayloadException|null $payloadException

The exception raised while validating the job payload.

from  Job
protected Container $container

The IoC container instance.

from  Job
protected bool $deleted

Indicates if the job has been deleted.

from  Job
protected bool $released

Indicates if the job has been released.

from  Job
protected bool $failed

Indicates if the job has failed.

from  Job
protected Closure> $beforeReleasingCallbacks

The callbacks to run before releasing the job.

from  Job
protected Closure> $beforeFailingCallbacks

The callbacks to run before recording the job as failed.

from  Job
protected string $connectionName

The name of the connection the job belongs to.

from  Job
protected string $queue

The name of the queue the job belongs to.

from  Job
protected Lease|null $poolLease

The lease pinning this job's pooled backend until a terminal operation.

from  Job
protected bool $poolLeaseAttached

Indicates whether this job has ever carried a pool lease.

from  Job
DateInterval|DateTimeInterface|int $releaseDelay

The delay the job was released with.

int $attempts

The number of attempts made to process the job.

Throwable|null $failedWith

The exception the job failed with.

Methods

int
secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

int
currentTime()

Get the current system time as a UNIX timestamp.

string
runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

int|string|null
getJobId()

Get the job identifier.

string
getRawBody()

Get the raw body of the job.

Job
withPoolLease(Lease $lease)

Attach the backend lease held for this job.

from  Job
void
onPoolLeaseAttached()

Initialize state that must be captured while the backend is pinned.

from  Job
void
releasePoolLease()

Return the pinned backend to its pool.

from  Job
void
discardPoolLease()

Discard the pinned backend instead of returning it to its pool.

from  Job
bool
poolLeaseIsFinalized()

Determine whether a previously attached backend lease is finalized.

from  Job
never
discardPoolLeaseAfterFailure(Throwable $exception)

Discard a backend after failure without masking the primary exception.

from  Job
string|null
uuid()

Get the UUID of the job.

from  Job
void
fire()

Fire the job.

from  Job
void
delete()

Delete the job from the queue.

bool
isDeleted()

Determine if the job has been deleted.

from  Job
void
release(int $delay = 0)

Release the job back into the queue after (n) seconds.

beforeReleasing(Closure $callback)

Register a callback to run before releasing the job.

from  Job
void
runBeforeReleasingCallbacks()

Run the callbacks before making another attempt available.

from  Job
bool
isReleased()

Determine if the job was released back into the queue.

from  Job
bool
isDeletedOrReleased()

Determine if the job has been deleted or released.

from  Job
bool
hasFailed()

Determine if the job has been marked as a failure.

from  Job
void
markAsFailed()

Mark the job as "failed".

from  Job
beforeFailing(Closure $callback)

Register a callback to run before recording the job as failed.

from  Job
void
runBeforeFailingCallbacks()

Run the callbacks before publishing the failure.

from  Job
void
fail(Throwable|null $e = null)

Delete the job, call the "failed" method, and raise the failed job event.

bool
shouldRollBackDatabaseTransaction(Throwable|null $e)

Determine if the current database transaction should be rolled back to level zero.

from  Job
void
failed(Throwable|null $e)

Process an exception that caused the job to fail.

from  Job
mixed
resolve(string $class)

Resolve the given class.

from  Job
mixed
getResolvedJob()

Get the resolved job handler instance.

from  Job
array
payload()

Get the decoded body of the job.

int|null
maxTries()

Get the number of times to attempt a job.

from  Job
int|null
maxExceptions()

Get the number of times to attempt a job after an exception.

from  Job
bool
shouldFailOnTimeout()

Determine if the job should fail when it timeouts.

from  Job
array|int|string|null
backoff()

The number of seconds to wait before retrying a job that encountered an uncaught exception.

from  Job
int|null
timeout()

Get the number of seconds the job can run.

from  Job
int|null
retryUntil()

Get the timestamp indicating when the job should timeout.

from  Job
string
getName()

Get the name of the queued job class.

from  Job
string
resolveName()

Get the resolved display name of the queued job class.

from  Job
string
resolveQueuedJobClass()

Get the class of the queued job.

from  Job
string
getConnectionName()

Get the name of the connection the job belongs to.

from  Job
string
getQueue()

Get the name of the queue the job belongs to.

from  Job
getContainer()

Get the service container instance.

from  Job
__construct(array $payload = [], string $connectionName = 'sync', string $queue = 'default')

No description

int
attempts()

Get the number of times the job has been attempted.

Details

in InteractsWithTime at line 17
protected int secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

Parameters

DateInterval|DateTimeInterface|int $delay

Return Value

int

in InteractsWithTime at line 29
protected int availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

int

in InteractsWithTime at line 47
protected DateTimeInterface|int parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

DateTimeInterface|int

in InteractsWithTime at line 63
protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

in InteractsWithTime at line 71
protected string runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

Parameters

float $startTime
float|null $endTime

Return Value

string

at line 39
int|string|null getJobId()

Get the job identifier.

Return Value

int|string|null

at line 47
string getRawBody()

Get the raw body of the job.

Return Value

string

in Job at line 111
Job withPoolLease(Lease $lease)

Attach the backend lease held for this job.

Parameters

Lease $lease

Return Value

Job

in Job at line 129
protected void onPoolLeaseAttached()

Initialize state that must be captured while the backend is pinned.

Return Value

void

in Job at line 136
protected void releasePoolLease()

Return the pinned backend to its pool.

Return Value

void

in Job at line 147
protected void discardPoolLease()

Discard the pinned backend instead of returning it to its pool.

Return Value

void

in Job at line 158
protected bool poolLeaseIsFinalized()

Determine whether a previously attached backend lease is finalized.

Return Value

bool

in Job at line 166
protected never discardPoolLeaseAfterFailure(Throwable $exception)

Discard a backend after failure without masking the primary exception.

Parameters

Throwable $exception

Return Value

never

in Job at line 181
string|null uuid()

Get the UUID of the job.

Return Value

string|null

in Job at line 189
void fire()

Fire the job.

Return Value

void

at line 82
void delete()

Delete the job from the queue.

Return Value

void

in Job at line 209
bool isDeleted()

Determine if the job has been deleted.

Return Value

bool

at line 63
void release(int $delay = 0)

Release the job back into the queue after (n) seconds.

Parameters

int $delay

Return Value

void

in Job at line 227
JobLifecycleCallbacks beforeReleasing(Closure $callback)

Register a callback to run before releasing the job.

Parameters

Closure $callback

Return Value

JobLifecycleCallbacks

in Job at line 237
protected void runBeforeReleasingCallbacks()

Run the callbacks before making another attempt available.

Return Value

void

in Job at line 247
bool isReleased()

Determine if the job was released back into the queue.

Return Value

bool

in Job at line 255
bool isDeletedOrReleased()

Determine if the job has been deleted or released.

Return Value

bool

in Job at line 263
bool hasFailed()

Determine if the job has been marked as a failure.

Return Value

bool

in Job at line 271
void markAsFailed()

Mark the job as "failed".

Return Value

void

in Job at line 279
JobLifecycleCallbacks beforeFailing(Closure $callback)

Register a callback to run before recording the job as failed.

Parameters

Closure $callback

Return Value

JobLifecycleCallbacks

in Job at line 289
protected void runBeforeFailingCallbacks()

Run the callbacks before publishing the failure.

Return Value

void

at line 90
void fail(Throwable|null $e = null)

Delete the job, call the "failed" method, and raise the failed job event.

Parameters

Throwable|null $e

Return Value

void

in Job at line 377
protected bool shouldRollBackDatabaseTransaction(Throwable|null $e)

Determine if the current database transaction should be rolled back to level zero.

Parameters

Throwable|null $e

Return Value

bool

in Job at line 393
protected void failed(Throwable|null $e)

Process an exception that caused the job to fail.

Parameters

Throwable|null $e

Return Value

void

in Job at line 407
protected mixed resolve(string $class)

Resolve the given class.

Parameters

string $class

Return Value

mixed

in Job at line 415
mixed getResolvedJob()

Get the resolved job handler instance.

Return Value

mixed

at line 55
array payload()

Get the decoded body of the job.

Return Value

array

in Job at line 464
int|null maxTries()

Get the number of times to attempt a job.

Return Value

int|null

in Job at line 472
int|null maxExceptions()

Get the number of times to attempt a job after an exception.

Return Value

int|null

in Job at line 480
bool shouldFailOnTimeout()

Determine if the job should fail when it timeouts.

Return Value

bool

in Job at line 490
array|int|string|null backoff()

The number of seconds to wait before retrying a job that encountered an uncaught exception.

Return Value

array|int|string|null

in Job at line 498
int|null timeout()

Get the number of seconds the job can run.

Return Value

int|null

in Job at line 506
int|null retryUntil()

Get the timestamp indicating when the job should timeout.

Return Value

int|null

in Job at line 514
string getName()

Get the name of the queued job class.

Return Value

string

in Job at line 524
string resolveName()

Get the resolved display name of the queued job class.

Resolves the name of "wrapped" jobs such as class-based handlers.

Return Value

string

in Job at line 534
string resolveQueuedJobClass()

Get the class of the queued job.

Resolves the class of "wrapped" jobs such as class-based handlers.

Return Value

string

in Job at line 542
string getConnectionName()

Get the name of the connection the job belongs to.

Return Value

string

in Job at line 550
string getQueue()

Get the name of the queue the job belongs to.

Return Value

string

in Job at line 558
Container getContainer()

Get the service container instance.

Return Value

Container

at line 29
__construct(array $payload = [], string $connectionName = 'sync', string $queue = 'default')

No description

Parameters

array $payload
string $connectionName
string $queue

at line 74
int attempts()

Get the number of times the job has been attempted.

Return Value

int