I have a ShopMicroService, a CustomerMicroService and a CartMicroService.
The ShopMicroService should work as an API Gateway and should be able ton control every other service. They are connected and routed with Netflix Zuul.
I want to be able to call e.g. localhost:8080/list, and see the data from both CustomerMicroService and CartMicroService. But I'm also not able to return two methods in my ShopController. How can I work around this?
Shop2CartConnector:
@FeignClient("cartmicroservice")
public interface Shop2CartConnectorRequester {
@GetMapping("/list")
public List<?> getCart();
Shop2CustomerConnector:
@FeignClient("customermicroservice")
public interface Shop2CustomerConnectorRequester {
@GetMapping("/list")
public List<?> getCustomer();
ShopController:
@ComponentScan
@RestController
public class ShopController {
final Shop2CustomerConnectorRequester shop2CustomerConnectorRequester;
final Shop2CartConnectorRequester shop2CartConnectorRequester;
@Autowired
public ShopController(Shop2CustomerConnectorRequester shop2CustomerConnectorRequester,
Shop2CartConnectorRequester shop2CartConnectorRequester) {
this.shop2CustomerConnectorRequester = shop2CustomerConnectorRequester;
this.shop2CartConnectorRequester = shop2CartConnectorRequester;
}
@GetMapping("/getCustomer")
public List<?> getCustomer() {
return shop2CustomerConnectorRequester.getCustomer();
}
@GetMapping("/getCart")
public List<?> getCart() {
return shop2CartConnectorRequester.getCart();
}
I already tried to call just one method and use both methods, but it still only shows of course only the list I am returning.