sql - How to simulate join concept using Micro service architecture -


i'm new @ micro service architecture, instance have 2 separate services in isolate machines , 2 sql databases,
location.service has db below

locations: [ {id: key, name: string} ] 

product.service has db below

products: [ {id: key, name: string, locationid: key} ] 

these 2 services can work beside using event based message protocol amqp , sound nice. have problem listing products in ui this

productid(ok), productname(ok), productlocationid(ok), productlocationname(???) 

how have solution listing products location name ? in simple monolith application, have join between these tables problem raises on multiple databases ?
solution1: query should has nested having locationname example in orm tools

var products = productservice.select(p => new productdto{ productid= p.id, productname= p.name, locationid= p.locationid, locationname= locationservice.getnamebyid(p.locationid) }).tolist();  

may way not reasonable
solution2: changing db design productservice this

products [ {id: key, name: string, locationid: key, locationname: string}  ]  

in way should update products location name(using event message) if name of location using locationservice has been changed so, think way should raise confusing in project's structure
solution3: these 2 services should in same service! in agile projects, can't estimate future had come services 1 service not recommended!

what best idea solving issue ?

assuming came product , location micro services based on factors. since need correlation between these 2 datasets, has done in micro service responsible this. new service interact these 2 services things done


Comments

Popular posts from this blog

ubuntu - PHP script to find files of certain extensions in a directory, returns populated array when run in browser, but empty array when run from terminal -

php - How can i create a user dashboard -

javascript - How to detect toggling of the fullscreen-toolbar in jQuery Mobile? -