KurrentDBBackend
Bases: Backend
KurrentDB integration backend for Event Sourcery.
Source code in event_sourcery_kurrentdb/__init__.py
configure(client, config=None)
Sets the backend configuration for KurrentDB client and outbox behavior.
Allows you to provide a KurrentDBClient instance and an optional SQLAlchemyConfig. If no config is provided, the default configuration is used. This method must be called before using the backend in production to ensure correct event publishing and subscription reliability.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
KurrentDBClient
|
The KurrentDB client instance to use for backend operations. |
required |
config
|
KurrentDBConfig | None
|
Optional custom configuration. If None, uses default SQLAlchemyConfig(). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The configured backend instance (for chaining). |
Source code in event_sourcery_kurrentdb/__init__.py
AsyncKurrentDBBackend
Bases: AsyncBackend
Async KurrentDB integration backend for Event Sourcery.
Async counterpart of KurrentDBBackend. All event store operations
are coroutines exposed via AsyncEventStore, AsyncOutbox and
AsyncSubscriptionBuilder resolved from this container.
Source code in event_sourcery_kurrentdb/async_/__init__.py
configure(client, config=None)
Sets the backend configuration for the async KurrentDB client.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
client
|
AsyncKurrentDBClient
|
The async KurrentDB client instance to use for backend operations. |
required |
config
|
KurrentDBConfig | None
|
Optional custom configuration. If None, uses default KurrentDBConfig(). |
None
|
Returns:
| Name | Type | Description |
|---|---|---|
Self |
Self
|
The configured backend instance (for chaining). |
Source code in event_sourcery_kurrentdb/async_/__init__.py
with_outbox(filterer=no_filter)
Enables the outbox for the backend.
Unlike the synchronous KurrentDBBackend, the persistent subscription
is not created here (a coroutine cannot be awaited from a sync method).
It is created lazily, before the first append or outbox run that needs
it — see AsyncKurrentDBOutboxStorageStrategy.ensure_subscription_created.
Source code in event_sourcery_kurrentdb/async_/__init__.py
KurrentDBConfig
Bases: BaseModel
Configuration for KurrentDBBackend event store integration.
Attributes:
| Name | Type | Description |
|---|---|---|
timeout |
Seconds | None
|
Optional timeout (in seconds) for KurrentDB operations. Controls the maximum time allowed for backend requests. If None, the default client timeout is used. |
outbox_name |
str
|
Name of the outbox stream used for reliable event publishing. |
outbox_attempts |
PositiveInt
|
Maximum number of outbox delivery attempts per event before giving up. |
Source code in event_sourcery_kurrentdb/__init__.py
KurrentDBStorageStrategy
Bases: StorageStrategy
Source code in event_sourcery_kurrentdb/event_store.py
16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 | |
AsyncKurrentDBStorageStrategy
Bases: AsyncStorageStrategy
Async counterpart of KurrentDBStorageStrategy.
Stores events in KurrentDB using the AsyncKurrentDBClient.
Source code in event_sourcery_kurrentdb/async_/event_store.py
18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | |
AsyncKurrentDBOutboxStorageStrategy
Bases: AsyncOutboxStorageStrategy
Async counterpart of KurrentDBOutboxStorageStrategy.
Implements the outbox on top of a KurrentDB persistent subscription
to the $all stream. Unlike the sync variant, the persistent
subscription is created lazily — before the first append that uses
the outbox or before the first outbox run — because the sync
with_outbox() configuration method cannot await coroutines.
Source code in event_sourcery_kurrentdb/async_/outbox.py
19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 | |
ensure_subscription_created()
async
Creates the persistent subscription for the outbox if missing.
Called lazily: by the storage strategy before the first append (so no event can bypass the outbox) and before each outbox run. Idempotent and safe to call concurrently.