18
votes
DDD: Avoid updating multiple aggregates within a transaction
What makes updating multiple Aggregate Roots in one request/transaction such a bad practice?
The problem is the other way around - trying to modify multiple aggregates in a single transaction is an ...
17
votes
Accepted
DDD: Avoid updating multiple aggregates within a transaction
From everything I've read, here and elsewhere, the reason seems to be that changing multiple aggregates in one transaction creates the requirement that they are stored on the same database host. (Let'...
16
votes
Rehydrating Aggregates from a "snapshots" projection rather than the Event Store
What I'm not super clear on is why you would ever rehydrate your Aggregates from the Event Store itself.
Because the "events" are the book of record.
If projecting changes to "read" databases is so ...
12
votes
How to handle transactional operations in an event-driven architecture?
In my experience, most questions about transactionability and microservices are caused by the following two reasons:
The transactional data is placed in different microservices: This is wrong by ...
8
votes
Accepted
DDD - Domain events vs application events
I'm considering two types of notifications
For a number of reasons, the literature is pretty weak here; but I believe that you will find that the taxonomy of "domain events" and "integration events" ...
8
votes
Be sure to send email only once
But in this case after email is sent someone may turn off server and then that information will not be stored in DB.
This is not something you can 100% cover in code.
It's always possible that the ...
7
votes
DDD: deciding when to lean towards eventual vs transactional consistency
It seems you are overthinking this. The advice is illustrated in a few different and related use cases.
1. User Submits Proposal: Use case where the user is responsible for ensuring Proposal is ...
7
votes
Accepted
How is cross device eventual consistency achieved in real time?
Different distributed systems try to achieve different consistency models. Eventual consistency is an extremely weak model that just says that eventually, all nodes will agree on a common state. It ...
6
votes
Rehydrating Aggregates from a "snapshots" projection rather than the Event Store
Since you don't specify what would the purpose of the "write" database would be, I will assume here that what you mean is this: when registering a new update to an aggregate, instead of rebuilding the ...
6
votes
What are the problems with command handlers returning data in CQRS?
CQRS is a principle, not a dogma. Like all principles, it has its positive and negative aspects in its own right. Departing from "pure CQRS" could just mean that you can't meaningfully ...
5
votes
Accepted
Is the C in ACID is not the C in CAP?
The meanings are slightly different I think. In short:
Consistency in ACID means that no dataset may be an invalid state or represents data which are semantically invalid after a transaction is ...
5
votes
DDD - Domain events vs application events
After watching the Udi Dahan's video, I'm trying the following approach:
I have an event store that contains the domain events,
And I have an achievement store that contains what has been accomplished....
5
votes
Accepted
CQRS - How can a command properly validate when queries are required?
How can I avoid and protect the command from the concurrency case exposed before?
The only way to "protect" yourself against concurrent changes is to hold a lock, which effectively means to have both ...
5
votes
How does a distributed system both tolerate network partition and achieve consistency?
The CAP Theorem says that you can only achieve at maximum two out of the three properties of Consistency (every read receives the most recent write or an error), Availability (every read receives a ...
5
votes
Accepted
In which database CQRS Command performs a Query?
If I need to take the customer info I need to read from the Write Database? It's a correct way?
Short answer: yes. But you're missing a few steps in your reasoning.
Commands and queries are ...
5
votes
How to handle data inconsistency in microservice architecture?
I believe there's three typical ways you could handle this:
Guarantee delivery of your messages
Run a reconciliation process
Switch to a pulled events approach
A little detail on each approach...
...
5
votes
Communication between services in a microservices architecture, is direct communication okay?
You mix a couple of things here, let's go in order:
1. "Event sourcing" is not a competing thing to "REST Endpoints", they have absolutely nothing to do with each other. "...
5
votes
Does quorum protocols circumvent fundamental limitations posed by the CAP theorem?
I think not.
A Quorum Protocol can't guarantee progress. This would fall into the Partition of CAP. ie when a partition occurs the QP activates to try to decide what to do, but can fall into a loop ...
4
votes
Microservices: Handling eventual consistency
What you're facing here is the two generals problem. In essence: how can you be sure a message is received and a response to that message occurs? In many cases, a perfect solution does not exist. In ...
4
votes
When to publish domain events when handling transactions in the application service
Have you considered to use the Outbox pattern? Saving the domain events into the database as well and dispatch them from the database (via a separate worker or by an out-of-the-box database-messaging ...
4
votes
Why is it considered hard to maintain strong consistency in a distributed system?
Retries aren’t guaranteed to succeed. And while your system is retrying, it isn’t available. For just reads, that is only a small problem. What happens when writes fail? “Just retry” doesn’t work ...
4
votes
How is cross device eventual consistency achieved in real time?
"Eventual consistency" means that the results will be consistent - eventually. In the scenario you describe, choosing an eventual consistency approach means that you accept that the results ...
4
votes
Ordering events across multiple topics in a distributed system
An obvious solution seem to be to use a single topic for events that needs to be ordered. You could use a single ProductStatus topic, with the type of status inside the message.
Another possible ...
3
votes
Accepted
CQRS, What reasons cause read model update delay? How to prevent user from taking inconsistence data?
I'm wonder how much read model delayed? What reason(s) cause it for delay? If I have only little preprocessing process data for read model. I have no experience at scale.
"It depends." The cause of ...
3
votes
Rehydrating Aggregates from a "snapshots" projection rather than the Event Store
The main reason is performance. You could store a snapshot for every commit (commit = the events that are generated by a single command, usually only one event) but this is costly. Along the snapshot ...
3
votes
Accepted
Aggregating data between microservices in twitter-like application
What you have here is not bad at all. You will find; however, that the user interface has different needs than a proper API. There are several ways to address this. The one that Facebook chose to ...
3
votes
How does a distributed system both tolerate network partition and achieve consistency?
How can we have both P and C in the second case?
I will answer with a common real-world example.
Common CP system in AWS cloud
Consider a distributed system made up of parts deployed to 3 ...
3
votes
Be sure to send email only once
Record the attempt to send and the success of sending separately.
Begin
try
UpdateRow(status = sending)
catch
Rollback
Commit
Begin
try
SendEmail()
UpdateRow(status = sent)
catch
...
3
votes
Accepted
Is weak consistency still relevant in systems that record timestamps?
Yes, it does. It makes sense whenever rectifying the consistency problems after-the-fact has advantages over preventing them in the first place. The reduced performance needed to ensure strong ...
3
votes
What are the problems with command handlers returning data in CQRS?
This approach appears to be frowned upon, given that most of the literature says that command handlers should not return domain data.
There are a lot of conflicting ideas in the space, and you have ...
Only top scored, non community-wiki answers of a minimum length are eligible
Related Tags
eventual-consistency × 78domain-driven-design × 25
microservices × 22
event-sourcing × 20
cqrs × 14
distributed-system × 13
architecture × 8
aggregate × 7
event × 6
distributed-computing × 5
transaction × 5
architectural-patterns × 4
message-queue × 4
read-model × 4
design × 3
database × 3
rest × 3
event-programming × 3
messaging × 3
consistency × 3
java × 2
c# × 2
domain-model × 2
event-handling × 2
fault-tolerance × 2