DatabaseOutboxRepository
class DatabaseOutboxRepository
Traits
Constants
| RETRY_DELAYS |
|
Methods
Insert database rows without exceeding the connection's binding limit.
Insert one database row chunk.
Get the statement binding limit without requiring a PDO-backed custom driver.
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.
Create a repository that resolves connections only for the current operation.
Get the configured outbox sources.
Resolve a configured outbox source in the current coroutine.
Insert finalized rows on the connection that owns the business transaction.
Claim eligible messages without retaining a database resource in the result.
Claim a PostgreSQL batch in one statement, retaining its original eligibility.
Claim rows on engines that support skipping another relay's locked rows.
Win eligible candidates through one atomic update on engines without skip-locked support.
Read the rows owned by this claim with their original eligibility.
Settle a validated result without modifying rows claimed by a newer relay.
Back off failed rows with seven retry deadlines rather than one case per row.
Get a bounded set of pending rows for operator inspection.
Find a stored message by its job UUID on the writer.
Read backlog counts and the age of the first currently eligible row.
Retry an attempted message unless a live relay owns it.
Retry the current backlog in bounded primary-key chunks, preserving attempt counts.
Delete an inspected row only while its lease remains inactive and unchanged.
Select attempted rows that are safe for an operator to reschedule.
Query the configured table on the writer, including for operator mutations.
Details
in
InsertsDatabaseRows at line 18
protected void
insertDatabaseRows(ConnectionInterface $connection, string $table, array $rows)
Insert database rows without exceeding the connection's binding limit.
in
InsertsDatabaseRows at line 43
protected void
insertDatabaseRowChunk(ConnectionInterface $connection, string $table, array $rows)
Insert one database row chunk.
in
InsertsDatabaseRows at line 53
protected int
maxBindings(ConnectionInterface $connection)
Get the statement binding limit without requiring a PDO-backed custom driver.
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 30
__construct(ConnectionResolverInterface $resolver, array $databases, string $table, int $retryAfter)
Create a repository that resolves connections only for the current operation.
at line 50
array
getDatabases()
Get the configured outbox sources.
at line 58
Connection
getConnection(string $database)
Resolve a configured outbox source in the current coroutine.
at line 72
void
insert(ConnectionInterface $connection, array $rows)
Insert finalized rows on the connection that owns the business transaction.
at line 82
array
claim(string $database, int $limit)
Claim eligible messages without retaining a database resource in the result.
at line 121
protected array
claimOnPostgres(ConnectionInterface $connection, int $limit, int $now, int $expiresAt, string $token)
Claim a PostgreSQL batch in one statement, retaining its original eligibility.
at line 144
protected array
claimWithSkipLocked(ConnectionInterface $connection, int $limit, int $now, int $expiresAt, string $token)
Claim rows on engines that support skipping another relay's locked rows.
at line 174
protected array
claimWithConditionalUpdate(ConnectionInterface $connection, int $limit, int $now, int $expiresAt, string $token)
Win eligible candidates through one atomic update on engines without skip-locked support.
at line 198
protected array
getClaimedRows(ConnectionInterface $connection, array $candidates, string $token)
Read the rows owned by this claim with their original eligibility.
at line 216
int
settle(string $database, array $messages, OutboxBatchResult $result)
Settle a validated result without modifying rows claimed by a newer relay.
at line 254
protected int
releaseFailed(ConnectionInterface $connection, string $token, array $ids, string $error)
Back off failed rows with seven retry deadlines rather than one case per row.
at line 288
array
pending(string $database, int $limit)
Get a bounded set of pending rows for operator inspection.
at line 296
object|null
find(string $database, string $uuid)
Find a stored message by its job UUID on the writer.
at line 306
array
statistics(string $database)
Read backlog counts and the age of the first currently eligible row.
at line 333
int
retry(string $database, string $uuid)
Retry an attempted message unless a live relay owns it.
at line 347
int
retryAll(string $database)
Retry the current backlog in bounded primary-key chunks, preserving attempt counts.
at line 383
bool
forget(string $database, int $id, string|null $leaseToken)
Delete an inspected row only while its lease remains inactive and unchanged.
at line 392
protected Builder
retryable(ConnectionInterface $connection, int $now)
Select attempted rows that are safe for an operator to reschedule.
at line 400
protected Builder
withoutLiveLease(Builder $query, int $now)
Exclude rows currently owned by a publishing relay.
at line 412
protected Builder
whereIds(Builder $query, array $ids)
Restrict a query to selected IDs using InnoDB's primary index.
at line 426
protected Builder
query(ConnectionInterface $connection)
Query the configured table on the writer, including for operator mutations.