I will usually have 5-6 events per aggregate and would like not to store projections in DB. What would be the easiest way always to make view projection at query time?
I think you can autowire the axon repository (like here https://docs.axoniq.io/reference-guide/implementing-domain-logic/command-handling/external-command-handler), load the aggregate and map it to any dto you like.
But Aggregate don’t necessarily have all the data from events inside. Also - this would mean that I use Aggregate for view projection which I guess is not actually good thing to do?
Hey, you can read events for an aggregate directly from event store
W dniu poniedziałek, 27 maja 2019 16:27:42 UTC+2 użytkownik Bojan Vukasovic napisał:
You can also create an in-memory view and handle events there. I think I saw something like this in the gift card demo repository, they use weak reference cache there, take a look
It depends on your database, if you use the same database for both queries and writes with spring boot then you can use spring projections?