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

GetAll in EventFlow #1082

Open
alexeyfv opened this issue Feb 18, 2025 · 1 comment
Open

GetAll in EventFlow #1082

alexeyfv opened this issue Feb 18, 2025 · 1 comment

Comments

@alexeyfv
Copy link
Contributor

alexeyfv commented Feb 18, 2025

Hi,

Could you suggest how to retrieve all aggregates or read models? I couldn't find any built-in functionality for this.

I understand that retrieving all aggregates is expensive in terms of performance, because EventFlow needs to replay all events for each aggregate.

However, it seems that read models also lack this functionality. I found an old issue (#550), but it was closed.

For example, If I have a UserAggregate and I want to display the list of users. How to do it?

Thanks.

@rasmus
Copy link
Member

rasmus commented Mar 9, 2025

I have been thinking of doing an implementation of this, but it would require the use of e.g. IAsyncEnumerable or something similar to keep the memory usage low. I have heard of users of EventFlow having literally thousands of events per aggregate and thus memory becomes a concern. It might be that EventFlow flow could ship with a "dumb" version that has a lot of caveats, e.g. does one at a time and doesn't care about changing aggregates after the process was done.

If you want to have an easy way to do it, merely get a list of all the aggregates from the store and use the IAggregateStore to iterate though all of them. You might want to partition the data and split it across multiple works.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants