Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | n/a |
0 / 0 |
n/a |
0 / 0 |
CRAP | n/a |
0 / 0 |
|||
| 1 | <?php |
| 2 | |
| 3 | declare(strict_types=1); |
| 4 | |
| 5 | namespace LambdaTwelve\OneRecord\Server\Spi; |
| 6 | |
| 7 | /** |
| 8 | * The server enqueues; the host delivers. Sending is deliberately not the |
| 9 | * SDK's job: it must go through the host's queue, retries, logging and |
| 10 | * egress allow-list. |
| 11 | * |
| 12 | * Timing: enqueue() is called inside the unit of work, next to the writes it |
| 13 | * announces. Hand the row to your queue only once that unit has committed, |
| 14 | * and let a rolled-back unit leave no job behind; a job dispatched at |
| 15 | * enqueue time finds no row yet, or survives an operation that failed. |
| 16 | * Delivery through any outbox is at least once, so the recipient deduplicates |
| 17 | * on the notification id (sent as Idempotency-Key by the SDK client). |
| 18 | * |
| 19 | * Ownership: what is enqueued is the notification as it was at that moment. |
| 20 | * An implementation must not be affected by later edits to the object it was |
| 21 | * handed, nor hand out its retained state to readers (serialising it, or |
| 22 | * copying the graph, both do). NotificationOutboxContract checks both. |
| 23 | */ |
| 24 | interface NotificationOutbox |
| 25 | { |
| 26 | public function enqueue(OutboundNotification $notification): void; |
| 27 | } |