In client application we moving parts of monotith system to microservices architecure. In a very simplistic way it looks so: - core application has it own database with products - microservices have own databases with various objects, which may be related to products.
Scenario 1: We want to show product "Apple" on page, with related data from microservice. It's easy: just get "Apple" from core-app database and retrieve additional data for this product from microservice. Good.
Scenario 2: We want to show list of products with various condidtions for core-app database and other conditions for microservice database. How to do it? Should I get - for example - 1000 products from database (core-app) and call microservice for additional data for these products? But how? Should I send one query with 1000 ids or 1000 api calls or get data from api service in portions, for example 10 api calls for 100 items? I don't like each of these options.
Scenario 3: We have "Warehouse" microservice.
I want list of first 100 products sorted by name, ascending, which have flag available = true in warehouse. How to do it? If I get 100 products from core-app db and then call api to check flag, then final list of products may be lower than 100. Getting list of all items available in warehouse is bad idea, because there may be milions of items, so execution time and api response size will be not acceptable.
Generally, I need an idea, how to merge some data from one db and some data from other db and return it to a user view.
App is written in php, but maybe some guys experienced in J2EE knows solutions for these problems?
Aucun commentaire:
Enregistrer un commentaire