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.
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.
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.
string
getJobId()
Get the job identifier.
string
getRawBody()
Get the raw body string for the job.
in
Job at line 82
string|null
uuid()
Get the UUID of the job.
in
Job at line 92
void
fire()
Fire the job.
void
delete()
Delete the job from the queue.
in
Job at line 116
bool
isDeleted()
Determine if the job has been deleted.
void
release(int $delay = 0)
Release the job back into the queue.
in
Job at line 137
bool
isReleased()
Determine if the job was released back into the queue.
in
Job at line 147
bool
isDeletedOrReleased()
Determine if the job has been deleted or released.
in
Job at line 157
bool
hasFailed()
Determine if the job has been marked as a failure.
in
Job at line 167
void
markAsFailed()
Mark the job as "failed".
in
Job at line 178
void
fail(Throwable|null $e = null)
Delete the job, call the "failed" method, and raise the failed job event.
in
Job at line 206
protected void
failed(Throwable|null $e)
Process an exception that caused the job to fail.
in
Job at line 223
protected mixed
resolve(string $class)
Resolve the given class.
in
Job at line 233
mixed
getResolvedJob()
Get the resolved job handler instance.
in
Job at line 243
array
payload()
Get the decoded body of the job.
in
Job at line 253
int|null
maxTries()
Get the number of times to attempt a job.
in
Job at line 263
int|null
maxExceptions()
Get the number of times to attempt a job after an exception.
in
Job at line 273
bool
shouldFailOnTimeout()
Determine if the job should fail when it timeouts.
in
Job at line 283
int|null
backoff()
The number of seconds to wait before retrying a job that encountered an uncaught exception.
in
Job at line 293
int|null
timeout()
Get the number of seconds the job can run.
in
Job at line 303
int|null
retryUntil()
Get the timestamp indicating when the job should timeout.
in
Job at line 313
string
getName()
Get the name of the queued job class.
in
Job at line 325
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 335
string
getConnectionName()
Get the name of the connection the job belongs to.
in
Job at line 345
string
getQueue()
Get the name of the queue the job belongs to.
in
Job at line 355
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.