Expand description
A durable queue of webhook deliveries (ADR 0037, audit H14).
Without one, push delivery is a few tries held in memory: a delivery
waiting in a task’s lane, or being retried, when the process stops is not
delivered by this replica or any other, terminal events included, and
nothing records that it was lost. With
RequestHandlerBuilder::with_push_outbox,
each event’s delivery to each of its task’s webhooks is a row: written by
the task’s lane once the event is stored, claimed by a worker on whichever
replica gets to it first, retried with backoff until the webhook answers
or the row is older than
push_outbox_max_age,
and removed when it is done.
§What a receiver sees
At least once: a delivery whose answer was lost, or whose replica stopped
after sending it, is sent again, from any replica, with the same
A2A-Delivery-Id (webhook::DELIVERY_ID_HEADER),
which is the row’s. A webhook sees a task’s events in the order they were
stored: a row is claimed only when no earlier row of the same webhook and
task is unfinished.
§Stores
InMemoryPushOutbox keeps nothing across a restart, and is the same
code path for a deployment whose other stores are in memory;
SqlitePushOutbox and PostgresPushOutbox (features sqlite,
postgres) keep the rows in a table of their own, a2a_push_outbox, and
the PostgreSQL one is shared by every replica that opens it.
Structs§
- Claimed
Delivery - A delivery a worker has claimed.
- Held
- A reservation whose hold has run out.
- InMemory
Push Outbox - An in-memory
PushOutbox. - NewDelivery
- One event’s delivery to one webhook, to be recorded.
- Postgres
Push Outbox - A
PushOutboxin a PostgreSQL database; see the module documentation. - Sqlite
Push Outbox - A
PushOutboxin an SQLite database; see the module documentation.
Constants§
- JITTER_
ONE - The denominator of a jitter:
jitteris a fraction of it.
Traits§
- Push
Outbox - Where webhook deliveries wait until they are delivered; see the module documentation.
Functions§
- backoff
- How long a delivery that failed
attemptstimes waits before the next. - jitter
- A jitter out of
JITTER_ONE, from a fresh random UUID: no new dependency for a number that needs to be spread, not unpredictable.
Type Aliases§
- Outbox
Future - A boxed future, as every
PushOutboxmethod returns.