Skip to content

AsyncOutboxStorageStrategy

Interface for async backend outbox storage implementation.

Source code in event_sourcery/_event_store/_async/outbox.py
class AsyncOutboxStorageStrategy:
    """
    Interface for async backend outbox storage implementation.
    """

    def outbox_entries(
        self, limit: int
    ) -> AsyncIterator[AbstractAsyncContextManager[RecordedRaw]]:
        """
        Returns an async iterator over async context managers for outbox entries
        to be published. The async context manager ensures transactional processing.

        If the event is processed without exception, it is removed from the outbox.

        If an exception occurs, the event remains in the outbox for retry.

        Args:
            limit (int): The maximum number of entries to return.

        Returns:
            AsyncIterator[AbstractAsyncContextManager[RecordedRaw]]:
                Async context managers to wrap record processing
        """
        raise NotImplementedError()

outbox_entries(limit)

Returns an async iterator over async context managers for outbox entries to be published. The async context manager ensures transactional processing.

If the event is processed without exception, it is removed from the outbox.

If an exception occurs, the event remains in the outbox for retry.

Parameters:

Name Type Description Default
limit int

The maximum number of entries to return.

required

Returns:

Type Description
AsyncIterator[AbstractAsyncContextManager[RecordedRaw]]

AsyncIterator[AbstractAsyncContextManager[RecordedRaw]]: Async context managers to wrap record processing

Source code in event_sourcery/_event_store/_async/outbox.py
def outbox_entries(
    self, limit: int
) -> AsyncIterator[AbstractAsyncContextManager[RecordedRaw]]:
    """
    Returns an async iterator over async context managers for outbox entries
    to be published. The async context manager ensures transactional processing.

    If the event is processed without exception, it is removed from the outbox.

    If an exception occurs, the event remains in the outbox for retry.

    Args:
        limit (int): The maximum number of entries to return.

    Returns:
        AsyncIterator[AbstractAsyncContextManager[RecordedRaw]]:
            Async context managers to wrap record processing
    """
    raise NotImplementedError()