# Start from First (/sdks/rust/how-to/events-store/start-from-first)



## Overview [#overview]

A new consumer joining an Events Store channel usually needs more than what happens next — it needs everything that already happened. `EventsStoreSubscription::StartFromFirst` solves that by replaying the channel's complete stored history before switching to live delivery, so a service can rebuild its state from scratch instead of starting with a blank slate and hoping nothing important was missed.

Under the hood, the broker walks the store from the oldest retained sequence forward, streaming each event to your async callback in order, then hands off to live delivery of new events without a gap. You don't manage offsets or checkpoints yourself — the start position is set once, at subscription time, via `EventsStoreSubscription::StartFromFirst`.

**Gotchas:** on a long-lived channel this can mean replaying millions of events before anything new shows up, so it's the wrong choice for a consumer that only cares about "from now on" (use `StartNewOnly` for that). Retention and expiration policies still apply — events already purged by TTL or max-count limits are gone and won't be replayed, so "full history" only means what the store still has.

## Prerequisites [#prerequisites]

* KubeMQ server running on `localhost:50000`
* Rust SDK installed (`cargo add kubemq`)

## Code [#code]

```rust title="main.rs"
use kubemq::prelude::*;
use kubemq::EventsStoreSubscription;
use std::time::Duration;

#[tokio::main]
async fn main() -> kubemq::Result<()> {
    let client = KubemqClient::builder()
        .host("localhost")
        .port(50000)
        .build()
        .await?;

    let sub = client.subscribe_to_events_store(
        "rust-events-store.start-from-first", "",
        EventsStoreSubscription::StartFromFirst,
        |event| Box::pin(async move {
            println!("Seq {}: {}", event.sequence, String::from_utf8_lossy(&event.body));
        }),
        None,
    ).await?;

    tokio::time::sleep(Duration::from_secs(5)).await;
    sub.unsubscribe().await;
    client.close().await?;
    Ok(())
}
```

## How It Works [#how-it-works]

* `StartFromFirst` replays all stored events, then continues delivering new ones.
* Useful for building read models, event sourcing, or catching up after downtime.
* Review timeouts, channel names, and client IDs before running against shared environments.
* Run the program while the server from the prerequisites is available.

## Related [#related]

* [Events Store overview](/learn/events-store)
* [Rust SDK Reference](/sdks/rust/reference/events-store)
* [Start from Last](/sdks/rust/how-to/events-store/start-from-last)
