RedisJob
class RedisJob extends Job implements Job (View source)
Traits
Properties
protected mixed | $instance | The job handler instance. |
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 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 RedisQueue | $redis | The Redis queue instance. |
|
protected string | $job | The Redis raw job payload. |
|
protected array | $decoded | The JSON decoded version of "$job". |
|
protected string | $reserved | The Redis job payload inside the reserved queue. |
Methods
Get the number of seconds until the given DateTime.
If the given value is an interval, convert it to a DateTime instance.
Given a start time, format the total run time for human readability.
Get the job identifier.
Get the raw body string for the job.
Delete the job from the queue.
Release the job back into the queue after (n) seconds.
Delete the job, call the "failed" method, and raise the failed job event.
The number of seconds to wait before retrying a job that encountered an uncaught exception.
Create a new job instance.
Get the number of times the job has been attempted.
Get the underlying Redis factory implementation.
Get the underlying reserved Redis job.
Details
protected int
secondsUntil(DateTimeInterface|DateInterval|int $delay)
Get the number of seconds until the given DateTime.
protected int
availableAt(DateTimeInterface|DateInterval|int $delay = 0)
Get the "available at" UNIX timestamp.
protected DateTimeInterface|int
parseDateInterval(DateTimeInterface|DateInterval|int $delay)
If the given value is an interval, convert it to a DateTime instance.
protected int
currentTime()
Get the current system time as a UNIX timestamp.
protected string
runTimeForHumans(float $startTime, float $endTime = null)
Given a start time, format the total run time for human readability.
string
getJobId()
Get the job identifier.
string
getRawBody()
Get the raw body string for the job.
in
Job at line 86
string|null
uuid()
Get the UUID of the job.
in
Job at line 96
void
fire()
Fire the job.
void
delete()
Delete the job from the queue.
in
Job at line 120
bool
isDeleted()
Determine if the job has been deleted.
void
release(int $delay = 0)
Release the job back into the queue after (n) seconds.
in
Job at line 141
bool
isReleased()
Determine if the job was released back into the queue.
in
Job at line 151
bool
isDeletedOrReleased()
Determine if the job has been deleted or released.
in
Job at line 161
bool
hasFailed()
Determine if the job has been marked as a failure.
in
Job at line 171
void
markAsFailed()
Mark the job as "failed".
in
Job at line 182
void
fail(Throwable|null $e = null)
Delete the job, call the "failed" method, and raise the failed job event.
in
Job at line 227
protected void
failed(Throwable|null $e)
Process an exception that caused the job to fail.
in
Job at line 244
protected mixed
resolve(string $class)
Resolve the given class.
in
Job at line 254
mixed
getResolvedJob()
Get the resolved job handler instance.
in
Job at line 264
array
payload()
Get the decoded body of the job.
in
Job at line 274
int|null
maxTries()
Get the number of times to attempt a job.
in
Job at line 284
int|null
maxExceptions()
Get the number of times to attempt a job after an exception.
in
Job at line 294
bool
shouldFailOnTimeout()
Determine if the job should fail when it timeouts.
in
Job at line 304
int|int[]|null
backoff()
The number of seconds to wait before retrying a job that encountered an uncaught exception.
in
Job at line 314
int|null
timeout()
Get the number of seconds the job can run.
in
Job at line 324
int|null
retryUntil()
Get the timestamp indicating when the job should timeout.
in
Job at line 334
string
getName()
Get the name of the queued job class.
in
Job at line 346
string
resolveName()
Get the resolved name of the queued job class.
Resolves the name of "wrapped" jobs such as class-based handlers.
in
Job at line 356
string
getConnectionName()
Get the name of the connection the job belongs to.
in
Job at line 366
string
getQueue()
Get the name of the queue the job belongs to.
in
Job at line 376
Container
getContainer()
Get the service container instance.
void
__construct(Container $container, RedisQueue $redis, string $job, string $reserved, string $connectionName, string $queue)
Create a new job instance.
int
attempts()
Get the number of times the job has been attempted.
RedisQueue
getRedisQueue()
Get the underlying Redis factory implementation.
string
getReservedJob()
Get the underlying reserved Redis job.