> ## Documentation Index
> Fetch the complete documentation index at: https://abxbus.archivebox.io/llms.txt
> Use this file to discover all available pages before exploring further.

# SQLiteHistoryMirrorMiddleware

> Mirror event and handler snapshots into SQLite tables.

`SQLiteHistoryMirrorMiddleware` records event and handler-result snapshots into SQLite for queryable audit history.

## Constructor params

* `db_path`: SQLite file path

## Setup with EventBus

<Tabs>
  <Tab title="Python">
    ```python theme={null}
    from abxbus import EventBus
    from abxbus.middlewares import SQLiteHistoryMirrorMiddleware

    bus = EventBus(
        name='AppBus',
        middlewares=[SQLiteHistoryMirrorMiddleware('./events.sqlite3')],
    )
    ```
  </Tab>

  <Tab title="Rust">
    ```rust theme={null}
    // Not implemented in the Rust crate yet.
    // Use explicit typed handler wrappers around bus.on(...) for this behavior for now.
    ```
  </Tab>
</Tabs>

## Behavior

* Records event lifecycle snapshots into `events_log`.
* Records handler result snapshots into `event_results_log`.
* Stores serialized payload JSON plus key metadata (event id/type, handler id/name, phase/status).
* Uses WAL mode and thread-safe connection access for concurrent writes.
