AsyncOutbox
Async outbox pattern implementation for reliable event publishing.
Async counterpart of Outbox. Uses an async storage strategy to fetch
outbox entries and an async publisher callable to publish them.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
strategy
|
AsyncOutboxStorageStrategy
|
The backend strategy for outbox storage and entry management. |
required |
serde
|
AsyncSerde
|
The serializer/deserializer for event records. |
required |
Source code in event_sourcery/_event_store/_async/outbox.py
run(publisher, limit=100)
async
Processes and publishes outbox entries using the provided publisher function.
Fetches entries from the outbox (up to the given limit), and passes each to the publisher. If the publisher raises an exception, the event remains in the outbox for retry. If processing succeeds, the event is removed from the outbox.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
publisher
|
Callable[[Recorded], Awaitable[None]]
|
Async function to publish a single event. |
required |
limit
|
int
|
Maximum number of entries to process in one run. Defaults to 100. |
100
|