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.
Get the number of seconds to delay a failed job before retrying it.
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
void
fire()
Fire the job.
void
delete()
Delete the job from the queue.
in
Job at line 106
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 127
bool
isReleased()
Determine if the job was released back into the queue.
in
Job at line 137
bool
isDeletedOrReleased()
Determine if the job has been deleted or released.
in
Job at line 147
bool
hasFailed()
Determine if the job has been marked as a failure.
in
Job at line 157
void
markAsFailed()
Mark the job as "failed".
in
Job at line 168
void
fail(Throwable|null $e = null)
Delete the job, call the "failed" method, and raise the failed job event.
in
Job at line 196
protected void
failed(Throwable|null $e)
Process an exception that caused the job to fail.
in
Job at line 213
protected mixed
resolve(string $class)
Resolve the given class.
in
Job at line 223
mixed
getResolvedJob()
Get the resolved job handler instance.
in
Job at line 233
array
payload()
Get the decoded body of the job.
in
Job at line 243
int|null
maxTries()
Get the number of times to attempt a job.
in
Job at line 253
int|null
delaySeconds()
Get the number of seconds to delay a failed job before retrying it.
in
Job at line 263
int|null
timeout()
Get the number of seconds the job can run.
in
Job at line 273
int|null
timeoutAt()
Get the timestamp indicating when the job should timeout.
in
Job at line 283
string
getName()
Get the name of the queued job class.
in
Job at line 295
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 305
string
getConnectionName()
Get the name of the connection the job belongs to.
in
Job at line 315
string
getQueue()
Get the name of the queue the job belongs to.
in
Job at line 325
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.