Skip to content

OutboxStorageStrategy

Interface for backend outbox storage implementation.

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

    def outbox_entries(
        self, limit: int
    ) -> Iterator[AbstractContextManager[RecordedRaw]]:
        """
        Returns an iterator over context managers for outbox entries to be published.
        The 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:
            Iterator[AbstractContextManager[RecordedRaw]]:
                Context managers to wrap record processing
        """
        raise NotImplementedError()

outbox_entries(limit)

Returns an iterator over context managers for outbox entries to be published. The 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
Iterator[AbstractContextManager[RecordedRaw]]

Iterator[AbstractContextManager[RecordedRaw]]: Context managers to wrap record processing

Source code in event_sourcery/_event_store/outbox.py
def outbox_entries(
    self, limit: int
) -> Iterator[AbstractContextManager[RecordedRaw]]:
    """
    Returns an iterator over context managers for outbox entries to be published.
    The 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:
        Iterator[AbstractContextManager[RecordedRaw]]:
            Context managers to wrap record processing
    """
    raise NotImplementedError()