AsyncSubscriptionStrategy
Interface for async event store backend subscription.
Async counterpart of SubscriptionStrategy. Defines the contract for
subscribing to event streams in various ways, returning async iterators
over batches of recorded events.
Source code in event_sourcery/_event_store/_async/subscription.py
subscribe_to_all(start_from, batch_size, timelimit)
Subscribes to all events in the event store, starting from a given position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_from
|
Position
|
The position to start reading events from. |
required |
batch_size
|
int
|
The maximum number of events to return in each batch. |
required |
timelimit
|
timedelta
|
The maximum time to spend reading one batch. |
required |
Returns:
| Type | Description |
|---|---|
AsyncIterator[list[RecordedRaw]]
|
AsyncIterator[list[RecordedRaw]]: An async iterator over batches of recorded events. |
Source code in event_sourcery/_event_store/_async/subscription.py
subscribe_to_category(start_from, batch_size, timelimit, category)
Subscribes to all events in a given category of streams, starting from a given position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_from
|
Position
|
The position to start reading events from. |
required |
batch_size
|
int
|
The maximum number of events to return in each batch. |
required |
timelimit
|
timedelta
|
The maximum time to spend reading one batch. |
required |
category
|
str
|
The category of streams to subscribe to. |
required |
Returns:
| Type | Description |
|---|---|
AsyncIterator[list[RecordedRaw]]
|
AsyncIterator[list[RecordedRaw]]: An async iterator over batches of recorded events. |
Source code in event_sourcery/_event_store/_async/subscription.py
subscribe_to_events(start_from, batch_size, timelimit, events)
Subscribes to all events of the given event types, starting from a position.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
start_from
|
Position
|
The position to start reading events from. |
required |
batch_size
|
int
|
The maximum number of events to return in each batch. |
required |
timelimit
|
timedelta
|
The maximum time to spend reading one batch. |
required |
events
|
list[str]
|
The list of event type names to subscribe to. |
required |
Returns:
| Type | Description |
|---|---|
AsyncIterator[list[RecordedRaw]]
|
AsyncIterator[list[RecordedRaw]]: An async iterator over batches of recorded events. |