question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

AggregateId disconnection between aggregate and state

See original GitHub issue

This trips me several times, and smells duplication:

  1. I have to compute the aggregate id in application service handlers,
  2. Then again in the When method in aggregate state

Also, if I don’t set the Id explicit on my state object, at least on the very first event, then my aggregate has no id.

I can see why the service need me to compute the id from incoming command, but the id is known at the time When runs. Which means it’s known to the aggregate. Is it really necessary to keep the id in the aggregate state?

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:25 (16 by maintainers)

github_iconTop GitHub Comments

0reactions
alexeyzimarevcommented, Apr 8, 2022

Ok, I want to close this one. I feel that I explained enough here https://github.com/Eventuous/eventuous/issues/75#issuecomment-1091655259

Now if you try to persist an aggregate without an id, it will throw. It’s a good enough guard rail.

Any improvements in terms of code are of course welcome, but I have to focus on other things.

Read more comments on GitHub >

github_iconTop Results From Across the Web

DDD loophole when one aggregate operation depends on ...
DDD loophole when one aggregate operation depends on state of another aggregate. I have found interesting problem in DDD, which can be solved ......
Read more >
Rule: Reference Other Aggregates by Identity
[Evans] states that one Aggregate may hold references to the Root of other ... This technique is called Disconnected Domain Model, ...
Read more >
DDD - the rule that Entities can't access Repositories directly
Some will use a Repository (12) from inside an Aggregate for lookup. This technique is called Disconnected Domain Model, and it's actually a ......
Read more >
Cosmos: Expose/manage SessionToken #192 - jet/equinox
... (Session) involves round-tripping a SessionToken value between the outcome of ... AggregateId disconnection between aggregate and state ...
Read more >
Beginner's Guide to Event Sourcing
All aggregated data needs to be saved successfully. If one rule or operation fails then the whole state change is rejected. In Event...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found