Hi, this description may weired! but as a POC I want to do something like ..
I have an Employee controller .this controller is concidered as main controller and having a methode which fetch all the employee details based on their grade.Now i have to create 2 microservices for my project.Age and Gender is the 2 seperate MS.I want to know the correct way of creating/implimenting these microservices.
In Employee controller
- [HttpPost("api/Employee/GetallEmployee")]
- public async Task GetallEmployee(input)
- {
- //i have to get merged json result here from below controllers(2 microservices having seperate db and seperate controller) and this url will connect with API gateway
- // I should merge these 2 result( using newtonsoft i can do it)
- //the merged json responce will concidered as main api
- //is this the correct way to create microservices?
- mergedresult= result1+result2
- }
But in this i have some microservices like Age and Gender means for creating microservices in to my solution i have created seperate 2 controller like AgeController and GenderController
But the challenge i am facing is i have to call the main api only api/Employee/GetallEmployee
by using this i have to call both below controller and in main methode i shud combain the 2 joson results.Anyone please help me
AgeController
- [HttpPost("api/Age/Ageofall")]
- public async Task Ageofall(input)
- {
- var result1 = await _getemployee.getalldetails(input);
- return new JsonResult(result1);
- }
- GenderController
- [HttpPost("api/Gender/Genderofall")]
- public async Task Genderofall(input)
- {
- var result2 = await _getemployee.getalldetails(input);
- return new JsonResult(result2);
- }
Please suggest the best practice to create microservices if i am doing wrong here..Thanks
Asma KhalidPosted Jan 19, 2021, 1:58 PM
Sachin SinghPosted Jan 19, 2021, 9:49 AM
_getEmployee.getalldetails