-
Notifications
You must be signed in to change notification settings - Fork 105
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
Introduce annotations and types for CQRS / Event Sourcing #18
Comments
Just a few thoughts on this:
|
Good points. I'll try to approach them one by one:
In summary, I wonder if a slightly different arrangement of annotations and artifacts makes sense and matches the observations a bit better:
👍
👍 |
As I build a CQRS based system I just would like to share which building blocks we use. The naming evolved incrementally over months as we refactored constantly. This is the current state: We also use Queries and Query handlers, but most of the time we don't need them. Querying the projection repository is fine without having a dedicated building block. Hope this helps... |
Sounds like we're in line to a large degree. I guess that for your global events you could got with jMolecules I like the suggestion to move to |
@abuijze and team – I wouldn't mind your feed back on this and what's been suggested in #39 to make sure we're not fundamentally at odds with what you have in Axxon. Of course, still assuming that developers might want/need to fall back onto Axxon specific annotations for more advanced use case. I hate to bring up this comparison but see this here as the "JPA" compared to "Hibernate" of CQRS / ES building block definitions. 😉 |
Hi @odrotbohm and others here. Sorry for being late to the game. I agree with many of the conclusions taken here. Just for completeness, here my 2ct on them:
I just wanted to provide a little context here before I dive into the PR (#39) that's already open for this. |
Almost forgot the last one: Query / Query Handler. I think it's important to include these. While Axon is quite opinionated and suggests using explicit Query objects, I think the concepts are more generally beneficial. A QueryHandler doesn't have to be a handler for these explicit query objects. It could simply mark an endpoint that is used to expose the query model to other components. Whether that's through explicit message objects (themselves marked with Maybe just a fun fact, but explicit Query objects have only been added relatively recently to Axon Framework. I didn't see the need for them for a long time. It is under "community pressure" that we decided to add the QueryBus and Query Messages. And I have to admit: they were right! |
We no provide annotations to express CQRS concepts like commands, command handlers, dispatchers and query models in application code. See the Javadoc of the introduced annotations for details. Also @domainevent was extended to carry new, optional attributes for symmetry with what's available for commands.
That's available now. |
I just spoke to @abuijze of Axon Framework and we wondered whether it'd make sense to introduce annotations and types to declare CQRS / Event Sourcing building blocks:
@Command
– type annotation@CommandHandler
– method annotation@(Domain)EventHandler
– method annotation@ViewModel
/@Projection
– type annotationAxon also provides annotations for querying:
@Query
@QueryHandler
but they seem to be a little more specific to Axon rather than a CQRS / ES concept that is to be mapped to types and packages in general.
Open questions
jddd-cqrs
) or a part of the already existingjddd-architecture
artifact. As using CQRS / ES as implementation is a pretty significant decision, I personally tend to vote for the former as I wouldn't want to impose the types on the classpath of someone who just pulled in thejddd-architecture
artifact on the classpath to e.g. demarcate layers.@EventHandler
but we have chosen@DomainEvent
in thejddd-events
module. Thus, I'd vote to name the corresponding handler annotation@DomainEventHandler
for consistency.@ViewModel
or@Projection
? I tend to vote for the former.The text was updated successfully, but these errors were encountered: