I want to make a microservice project including some microservices like: page, order, products and etc. I have two questions about that:
I want to know if it is a good idea to reuse the same microservice in different projects and store multiple websites data in one microservice and retrieve corresponding data by the project token?
For example we have website A and website B and share their data in the same microservice database and products microservice holds website A and website B products.
If reusing microservice is a good idea, then problems may occur if maybe there are some slight changes between website A and website B products. Should I rewrite another microservice for website B or write a generic product microservice so it can handle different types of products?
For the first time you can write generic service that is used by two or more consumers, but it will bring you problems if business logic changes for one of the consumers.
My advice would be, if you think that system will not change frequently and does not grow much, make shared service, otherwise decoupling would be much better approach.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With