Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Event Sourcing Repositories #19

Open
tsutomi opened this issue Oct 15, 2023 · 0 comments · May be fixed by #23
Open

Event Sourcing Repositories #19

tsutomi opened this issue Oct 15, 2023 · 0 comments · May be fixed by #23
Assignees
Labels
enhancement New feature or request

Comments

@tsutomi
Copy link
Member

tsutomi commented Oct 15, 2023

The Repository pattern is not naturally designed to be used in an event-sourcing context, given the nature of the event stream and aggregate models.

Anyway, a repository is intended to be a construct between a database and an application, to abstract access to the data through a common pattern: even-driven storage systems work with a different paradigm than the relational database system or the NoSQL systems, but they have an element in common, that is the object-centricity of the information (Entity and Agrgegate).

In an event-driven logic, the core element is the Event: the aggregation of a stream of events (identified by an arbitrary logic) makes an Aggregate, that presents the latest state of an Entity

Proposed Changes

We should try to pursue the implementation of a Repository that supports event-sourcing, working on the principles:

  • Implementation of a base Aggregate contract that allows the aggregation of events to be persisted by the Repository
  • The EventRepository retrieves the uncommitted events available from the Aggregate
  • Definition of an AggregateKey construct that identifies the aggregate and its revision

Possible Limitations

Repositories that implement the support for event-sourcing might also be limited:

  • A repository might not be dynamically queryable or filterable - Projectsions are constructs that require a pre-defined aggregation logic
  • Listing the aggregates might be not possible - event streams are specific to a given entity, and data storage systems might not support retrieving events for more than one entity
@tsutomi tsutomi added the enhancement New feature or request label Oct 15, 2023
@tsutomi tsutomi self-assigned this Oct 15, 2023
@tsutomi tsutomi linked a pull request Oct 18, 2023 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant