SqsJob
class SqsJob 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 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 |
| protected string|null | $cachedRawBody | The cached raw body of the job. |
Methods
Get the number of seconds until the given DateTime.
Get the "available at" UNIX timestamp.
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.
Initialize state that must be captured while the backend is pinned.
Determine whether a previously attached backend lease is finalized.
Discard a backend after failure without masking the primary exception.
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.
Determine if the current database transaction should be rolled back to level zero.
The number of seconds to wait before retrying a job that encountered an uncaught exception.
Create a new job instance.
Reset the SQS message's visibility timeout so it becomes available again.
Delete the message from the SQS queue.
Delete the offloaded overflow payload from the cache, if applicable.
Get the number of times the job has been attempted.
Resolve the pointer path from the job body, if present.
Resolve the configured cache store for overflow payloads.
Get the underlying SQS client instance.
Get the underlying raw SQS job.
Details
in
InteractsWithTime at line 17
protected int
secondsUntil(DateInterval|DateTimeInterface|int $delay)
Get the number of seconds until the given DateTime.
in
InteractsWithTime at line 29
protected int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)
Get the "available at" UNIX timestamp.
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.
in
InteractsWithTime at line 63
protected int
currentTime()
Get the current system time as a UNIX timestamp.
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.
at line 144
int|string|null
getJobId()
Get the job identifier.
at line 152
string
getRawBody()
Get the raw body string for the job.
in
Job at line 113
protected void
onPoolLeaseAttached()
Initialize state that must be captured while the backend is pinned.
in
Job at line 120
protected void
releasePoolLease()
Return the pinned backend to its pool.
in
Job at line 131
protected void
discardPoolLease()
Discard the pinned backend instead of returning it to its pool.
in
Job at line 142
protected bool
poolLeaseIsFinalized()
Determine whether a previously attached backend lease is finalized.
in
Job at line 150
protected never
discardPoolLeaseAfterFailure(Throwable $exception)
Discard a backend after failure without masking the primary exception.
in
Job at line 165
string|null
uuid()
Get the UUID of the job.
in
Job at line 173
void
fire()
Fire the job.
at line 68
void
delete()
Delete the job from the queue.
in
Job at line 193
bool
isDeleted()
Determine if the job has been deleted.
at line 40
void
release(int $delay = 0)
Release the job back into the queue after (n) seconds.
in
Job at line 209
bool
isReleased()
Determine if the job was released back into the queue.
in
Job at line 217
bool
isDeletedOrReleased()
Determine if the job has been deleted or released.
in
Job at line 225
bool
hasFailed()
Determine if the job has been marked as a failure.
in
Job at line 233
void
markAsFailed()
Mark the job as "failed".
in
Job at line 241
void
fail(Throwable|null $e = null)
Delete the job, call the "failed" method, and raise the failed job event.
in
Job at line 315
protected bool
shouldRollBackDatabaseTransaction(Throwable|null $e)
Determine if the current database transaction should be rolled back to level zero.
in
Job at line 331
protected void
failed(Throwable|null $e)
Process an exception that caused the job to fail.
in
Job at line 345
protected mixed
resolve(string $class)
Resolve the given class.
in
Job at line 353
mixed
getResolvedJob()
Get the resolved job handler instance.
in
Job at line 361
array
payload()
Get the decoded body of the job.
in
Job at line 402
int|null
maxTries()
Get the number of times to attempt a job.
in
Job at line 410
int|null
maxExceptions()
Get the number of times to attempt a job after an exception.
in
Job at line 418
bool
shouldFailOnTimeout()
Determine if the job should fail when it timeouts.
in
Job at line 428
array|int|string|null
backoff()
The number of seconds to wait before retrying a job that encountered an uncaught exception.
in
Job at line 436
int|null
timeout()
Get the number of seconds the job can run.
in
Job at line 444
int|null
retryUntil()
Get the timestamp indicating when the job should timeout.
in
Job at line 452
string
getName()
Get the name of the queued job class.
in
Job at line 462
string
resolveName()
Get the resolved display name of the queued job class.
Resolves the name of "wrapped" jobs such as class-based handlers.
in
Job at line 472
string
resolveQueuedJobClass()
Get the class of the queued job.
Resolves the class of "wrapped" jobs such as class-based handlers.
in
Job at line 480
string
getConnectionName()
Get the name of the connection the job belongs to.
in
Job at line 488
string
getQueue()
Get the name of the queue the job belongs to.
at line 27
__construct(Container $container, SqsClient $sqs, array $job, string $connectionName, string $queue, array $overflowStorage = [])
Create a new job instance.
at line 56
protected void
changeMessageVisibilityInSqs(int $delay)
Reset the SQS message's visibility timeout so it becomes available again.
at line 110
protected void
deleteMessageFromSqs()
Delete the message from the SQS queue.
at line 121
protected void
deleteOverflowPayload()
Delete the offloaded overflow payload from the cache, if applicable.
at line 136
int
attempts()
Get the number of times the job has been attempted.
at line 174
protected string|null
overflowPointer()
Resolve the pointer path from the job body, if present.
at line 196
protected Repository
overflowStore()
Resolve the configured cache store for overflow payloads.
at line 209
SqsClient
getSqs()
Get the underlying SQS client instance.
at line 221
array
getSqsJob()
Get the underlying raw SQS job.