# Event Sourcing Aggregates

## The Problem

You're a year into your Order system. Compliance asks: "show me everything that happened to order #4192, with timestamps, in order." You can't — the `orders` table only stores the current row. The audit log you bolted on is missing two columns and the listener that wrote to it crashed silently in 2023.

## How Ecotone Solves It

An **Event Sourced Aggregate** stores its history as a sequence of events (`OrderWasPlaced`, `LineItemAdded`, `PaymentReceived`, `OrderShipped`) instead of just its current state. The current state is a function of the events. The audit log isn't a separate concern — it **is** the storage. When you need a new read model (a list page, a search index, a reporting view), Projections feed off the same event stream without rerunning your handlers.

Reach for an event-sourced aggregate when the *history* matters as much as the current state — finance, healthcare, billing, regulated audit trails — or when you'll want to derive multiple read models from the same domain over time.

The pages below walk through declaring event-sourced aggregates, applying events to rebuild state, and the different ways to record events from your handlers.

{% content-ref url="/pages/aLJpFfeCOUvqTKvGRowA" %}
[Working with Aggregates](/modelling/event-sourcing/event-sourcing-introduction/event-sourcing-aggregates/working-with-aggregates.md)
{% endcontent-ref %}

{% content-ref url="/pages/ep9rGfhWNPswEdNTrwCR" %}
[Applying Events](/modelling/event-sourcing/event-sourcing-introduction/event-sourcing-aggregates/applying-events.md)
{% endcontent-ref %}

{% content-ref url="/pages/ijCIUGxrpluFkkol4UTO" %}
[Different ways to Record Events](/modelling/event-sourcing/event-sourcing-introduction/event-sourcing-aggregates/different-ways-to-record-events.md)
{% endcontent-ref %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.ecotone.tech/modelling/event-sourcing/event-sourcing-introduction/event-sourcing-aggregates.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
