Answer the question
In order to leave comments, you need to log in
Is it correct to copy data between microservices?
Hello.
Our project uses a micro-service architecture (at least we think so). There is an application for managing certain entities. Let's take a list of movies as an example. Communication between applications occurs both synchronously (HTTP, RPC) and asynchronously using events and commands.
Let's say we have micro-services that perform the following functionality:
Answer the question
In order to leave comments, you need to log in
1. All data is stored in one database.
2. The base has a management system with API. When you change the schema, you change the API device, but not its external interface.
3. All consumers and data producers use this common API. They are used flexibly, for example, through GraphQL. (Personally, I lack its flexibility, I wrote my own.) If the microservice changes, the request is rewritten, not the API.
There must be one base per entry. On reading you can make replication.
Accordingly, according to this scheme, each service that can work relatively independently.
A news site, for example, might have:
Each micro-service needs different information about the movie.It may be necessary to send enough information through the message broker that is necessary for the operation of each service. Then you do not need to apply for data to another.
They take the necessary data, save it to the local database and work with it. With this, a lot of problems are possible in the form of data inconsistency, etc.It would be necessary to clarify why the inconsistency and other problems. Otherwise, how can you help without knowing the problem?
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question