Skip to content

Configurable allowed metadata headers for event-sourced aggregates #575

@lifinsky

Description

@lifinsky

Description

When working with distributed command/event handlers in an Event Sourcing setup, Ecotone automatically forwards all message metadata into the event stream. While this is correct behaviour in terms of message propagation, it creates a performance issue in real-world systems:

Many metadata headers coming from distributed handlers are irrelevant for event-sourced aggregates.

These headers get persisted in every event, often growing event size significantly.

As a result, event replay becomes slower, especially for large aggregates, even though these metadata values are not consumed by event sourcing handlers.

In high-throughput systems this overhead accumulates quickly.

Example

Introduce a configuration option at the aggregate level (or global ES configuration) to explicitly define which metadata headers should be stored.

Example (conceptual)

#[EventSourcingAggregate(
    allowedMetadata: ['providerId', 'merchantId']
)]
final class PaymentAggregate { ... }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions