class OutboxRelay

Traits

Methods

int
secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

int
availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

parseDateInterval(DateInterval|DateTimeInterface|int|null $delay)

If the given value is an interval, convert it to a DateTime instance.

int
currentTime()

Get the current system time as a UNIX timestamp.

string
runTimeForHumans(float $startTime, float|null $endTime = null)

Given a start time, format the total run time for human readability.

publishOutboxMessagesSequentially(Queue $queue, array $messages)

Publish due raw messages and defer future messages without losing their delays.

__construct(DatabaseOutboxRepository $repository, Factory $queues, Dispatcher $events, ExceptionHandler $exceptions)

Create a relay whose dependencies do not retain borrowed connections.

array
claim(string $database, int $limit)

Claim messages and release the source connection before returning.

bool
deliver(string $database, array $messages)

Publish and settle a claimed batch, returning whether it completed without failure.

bool
shouldStopDelivery(Throwable $exception)

Determine whether cancellation requires delivery to stop.

validateResult(array $messages, OutboxBatchResult $result)

Reject driver results that cannot safely identify the rows to settle.

void
reportOutcome(string $database, string $connection, array $messages, OutboxBatchResult $result, Throwable|null $settlementFailure, float $duration, int $publishedAt)

Notify listeners and report failures after publication and settlement have released their resources.

mixed
inFreshCoroutine(Closure $callback)

Finish an operation's resource cleanup before returning or propagating cancellation.

Details

in InteractsWithTime at line 17
protected int secondsUntil(DateInterval|DateTimeInterface|int $delay)

Get the number of seconds until the given DateTime.

Parameters

DateInterval|DateTimeInterface|int $delay

Return Value

int

in InteractsWithTime at line 29
protected int availableAt(DateInterval|DateTimeInterface|int|null $delay = 0)

Get the "available at" UNIX timestamp.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

int

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.

Parameters

DateInterval|DateTimeInterface|int|null $delay

Return Value

DateTimeInterface|int

in InteractsWithTime at line 63
protected int currentTime()

Get the current system time as a UNIX timestamp.

Return Value

int

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.

Parameters

float $startTime
float|null $endTime

Return Value

string

protected OutboxBatchResult publishOutboxMessagesSequentially(Queue $queue, array $messages)

Publish due raw messages and defer future messages without losing their delays.

Parameters

Queue $queue
array $messages

Return Value

OutboxBatchResult

at line 29
__construct(DatabaseOutboxRepository $repository, Factory $queues, Dispatcher $events, ExceptionHandler $exceptions)

Create a relay whose dependencies do not retain borrowed connections.

Parameters

DatabaseOutboxRepository $repository
Factory $queues
Dispatcher $events
ExceptionHandler $exceptions

at line 42
array claim(string $database, int $limit)

Claim messages and release the source connection before returning.

Parameters

string $database
int $limit

Return Value

array

at line 52
bool deliver(string $database, array $messages)

Publish and settle a claimed batch, returning whether it completed without failure.

Parameters

string $database
array $messages

Return Value

bool

at line 121
protected bool shouldStopDelivery(Throwable $exception)

Determine whether cancellation requires delivery to stop.

Parameters

Throwable $exception

Return Value

bool

at line 131
protected OutboxBatchResult validateResult(array $messages, OutboxBatchResult $result)

Reject driver results that cannot safely identify the rows to settle.

Parameters

array $messages
OutboxBatchResult $result

Return Value

OutboxBatchResult

at line 169
protected void reportOutcome(string $database, string $connection, array $messages, OutboxBatchResult $result, Throwable|null $settlementFailure, float $duration, int $publishedAt)

Notify listeners and report failures after publication and settlement have released their resources.

Parameters

string $database
string $connection
array $messages
OutboxBatchResult $result
Throwable|null $settlementFailure
float $duration
int $publishedAt

Return Value

void

at line 244
protected mixed inFreshCoroutine(Closure $callback)

Finish an operation's resource cleanup before returning or propagating cancellation.

Parameters

Closure $callback

Return Value

mixed