Sriram Sharma wrote:
So you had only one database for all services. Is it?
I think to understand what you're asking between the lines: if each microservice should use its own database.
Well, in theory
each microservice should be completely isolated from other microservices, of course except for the API it exposes. In this sense, use separated database make perfectly sense.
But in practice
I could not say if it's always a good idea. For example, let's suppose that in the scenario you described a microservice A is responsible for registering orders, and calls microservice B to book goods in the warehouse.
Internal representation of "inventory item" could be in theory very different for each microservice. And that's right, because in theory you could replace microservice B with something else. But what happens when you need to create some report
which needs to join orders and inventory data, for example how many goods have been shipped last month , to fullfill which orders ? At the very end, you may want to build a report service that directly accesses to both databases managed by A and B, or, otherwise,
you need to manually get orders data from A, inventory data from B and manually put them together. I don't think that's an handy process....
In my humble opinion, it's better if the database is the same, and to impose some strict rule to prevent services to by-pass each other, by accessing directly tables they are not responsible to manage.