SubscriptionStrategy
Interface for event store backend subscription. Defines the contract for subscribing to event streams in various ways.
Source code in event_sourcery/_event_store/subscription/interfaces.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 |
|---|---|
Iterator[list[RecordedRaw]]
|
Iterator[list[RecordedRaw]]: An iterator over batches of recorded events. |
Source code in event_sourcery/_event_store/subscription/interfaces.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 |
|---|---|
Iterator[list[RecordedRaw]]
|
Iterator[list[RecordedRaw]]: An iterator over batches of recorded events. |
Source code in event_sourcery/_event_store/subscription/interfaces.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 |
|---|---|
Iterator[list[RecordedRaw]]
|
Iterator[list[RecordedRaw]]: An iterator over batches of recorded events. |