RenderDocument
in package
implements
ShouldQueue
uses
InteractsWithQueue, Queueable
Renders a quote, delivery note, reminder or other document in the queue and stores it on a disk. The document travels as versioned JSON snapshot (DocumentData::toSnapshot(), brought up to date by quittio.snapshots.document_upcasters), the render options as versioned JSON.
Errors that another attempt cannot fix fail the job at once; others are retried.
Table of Contents
Interfaces
- ShouldQueue
Constants
- PERMANENT_ERRORS : array<string|int, mixed> = [\Quittio\Core\Calculation\CalculationException...
- Exceptions that fail the job without a further attempt.
Properties
- $backoff : array<int, int>
- $disk : string|null
- $document : string
- $options : string
- $path : string|null
- $tries : int
Methods
- __construct() : mixed
- data() : DocumentData
- The document of the job, upcast with the document upcasters of the application.
- failed() : void
- Called by the queue worker when the job failed for good.
- handle() : void
- Renders the document with the events of a render run, stores it and dispatches QueuedDocumentStored.
- middleware() : array<int, object>
- of() : self
- The job of a document and its render options.
- renderOptions() : RenderOptions
- The render options of the job.
Constants
PERMANENT_ERRORS
Exceptions that fail the job without a further attempt.
public
array<string|int, mixed>
PERMANENT_ERRORS
= [\Quittio\Core\Calculation\CalculationException::class, \Quittio\Core\Exceptions\ConfigurationException::class, \Quittio\Core\Exceptions\HydrationException::class, \Quittio\Core\Serialization\Snapshots\SnapshotVersionException::class, \Quittio\Core\Exceptions\InvalidArgumentException::class, \JsonException::class]
Properties
$backoff
public
array<int, int>
$backoff
= [10, 60]
seconds before the second and the third attempt
$disk read-only
public
string|null
$disk
= null
$document read-only
public
string
$document
$options read-only
public
string
$options
$path read-only
public
string|null
$path
= null
$tries
public
int
$tries
= 3
Methods
__construct()
public
__construct(string $document, string $options[, string|null $disk = null ][, string|null $path = null ]) : mixed
Parameters
- $document : string
-
JSON of DocumentData::toSnapshot()
- $options : string
-
JSON of RenderOptions::toArray()
- $disk : string|null = null
- $path : string|null = null
data()
The document of the job, upcast with the document upcasters of the application.
public
data() : DocumentData
Tags
Return values
DocumentDatafailed()
Called by the queue worker when the job failed for good.
public
failed(Throwable $exception) : void
Parameters
- $exception : Throwable
handle()
Renders the document with the events of a render run, stores it and dispatches QueuedDocumentStored.
public
handle(QuittioManager $quittio) : void
Parameters
- $quittio : QuittioManager
middleware()
public
middleware() : array<int, object>
Return values
array<int, object>of()
The job of a document and its render options.
public
static of(DocumentData $document, RenderOptions $options[, string|null $disk = null ][, string|null $path = null ]) : self
Parameters
- $document : DocumentData
- $options : RenderOptions
- $disk : string|null = null
- $path : string|null = null
Return values
selfrenderOptions()
The render options of the job.
public
renderOptions() : RenderOptions