I'm using a microservice architecture. when something went in one microservice I want to catch it in another microservice. To say briefly I have synchronization. But there I have one problem, I have a domain model with its own attributes and behavior, I would like to get that data in another microservice. Basically I'm just sending a request from one Microservice to another and I'm pulling some data, but to get this data I need to have the same model in both microservice.
I got two possible choices:
- To have two model one for Domain model and another for response a.k.a "DTO". (Disadvantage: If I update something in the domain model I should update it in the DTO model.)
- To have a lot of atomic models for specific tasks. (Disadvantage: hard to maintain all of the models)
I'm looking for best practices for this specific decision.