Re: [axonframework] queryHandler on aggregate - skip projection

32 views
Skip to first unread message

Allard Buijze

unread,
May 16, 2018, 2:13:27 AM5/16/18
to axonfr...@googlegroups.com
While this topic was simultaneously adressed in another thread, here’s a brief response:

You can! There is no strict requirement to apply CQRS when using Axon. In some cases, it might make perfect sense to have a model that is used for writes as well as _some_ reads. Be careful, however, while the single model might be simple now, in the future, when requirements evolve, it may mean that you’re introducing accidental complexity. And this requires aggregates to be state-stored to be sensible.

Also, putting @QueryHandler methods on an aggregate, besides technically not possible at the moment, only has limited use: you’d only be able to query the state of a single aggregate.

Cheers,

Allard
On Tue, 15 May 2018 at 09:23, <jan.ga...@holisticon.de> wrote:
I suppose this falls in the style/smell category, but I wonder: If my aggregates state holds all the info I need, would it be possible to have @QueryHandlers directly on the aggregate and answer them from there? Or is it required to build a projection based on @EventHandlers to implement a queryHandler? What would be consequences of such a design? 
Just naively  thinking about it, I guess it might be a good fit ... "write" changes only come via command handler on the aggregate and "read" access is implemented by query handlers anyway, why bother having an additional presentation?

Thakns for your insight
Jan

--
You received this message because you are subscribed to the Google Groups "Axon Framework Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to axonframewor...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
Allard Buijze
CTO

E: allard...@axoniq.io
T: +31 6 34 73 99 89
Reply all
Reply to author
Forward
0 new messages