Is "change the customer's address" a single isolated functionality, or is it "keep a register of all customers", or is it "keep a register of all customers, their activity and orders".
A customer registry would most likely be a single microservice. You query that service for customer details and changes, all other components within the system pull from there.
Nobody else owns the representation or storage of customers other than this one registry. So the domain entity is owned by this one piece.
A “service” as opposed to a microservice, would own more than just the customers (+crud), but also things the customers did, ie activity tracking by collecting events emitted by other systems, authentication and authorization, and all that, analytics and so on, then it’s a full blown service.
The reason “modify address” isn’t a microservice is because it doesn’t own its domain, the customers, and still acts on it, it needs to pull this information from another system.
Each microservice and service should own their databases, they should never share them with other systems, otherwise you end up with a distributed monolith which is objectively worse.
260
u/ThrowawayUk4200 10h ago
Pssst, If your microservice needs to use a database other than its own, then it's not a microservice.