The hardest problem.
WHAT IS LOST
Transactions spanning services.
WHY
Each service has its own database, and there is no shared transaction.
WHAT THAT MEANS
An operation touching several services can partially succeed.
WHAT THE APPROACHES ARE
Accepting eventual consistency Coordinating a sequence with compensating actions when a step fails
WHAT A COMPENSATING ACTION IS
An operation undoing a previous step, since it cannot be rolled back.
WHY THAT IS DIFFICULT
Undoing is not always possible, and the compensation can itself fail.
WHAT TO DO ABOUT REPORTING ACROSS SERVICES
Publish events, and build a read model.
WHY
Querying several services to assemble a report is slow and fragile.
WHAT TO ACCEPT
That data will be briefly inconsistent.
WHAT TO ESTABLISH
Where that is acceptable and where it is not.
WHAT TO KEEP IN ONE SERVICE
Anything requiring genuine transactional consistency.
WHY
That requirement is a strong argument against splitting at that boundary.
WHAT TO RECORD
Every event, so state can be reconstructed and discrepancies investigated.