How is the Api forwarding calls to respective microservices?


#1

Would it be possible to clarify how is the initial HTTP query which arrives to ProductsController in the API gateway (DShop.Api) project being forwarded to the actual microservice for product (DShop.Services.Products) which is the service responsible for providing the actual response ?

While a breakpoint in the ProductsController in DShop.Api project is reached after a call to (localhost:5000/products), strangely a break point in the ProductsController in the DShop.Services.Products is not being involed from the gateway.

Reading further, I’ve noticed you are using the library RestEase which registers forwarders, so I suppose some magic is happening here to relay the call to the final microservice, but shouldn’t the breakpoint in the product service controller be reached eventually ? Could Redis caching be playing a role here, and responding to this query from the gateway without further invoking the service ?


#2

Responding to my own question here :slight_smile:
I must have missed something, because having tried this again, I’ve noticed the sequence of invocations is effectively the expected one

  • DShop.Api.Controllers.ProductsController.Get(…)
    then
  • DShop.Services.Products.Controllers.ProductsController.Get(…)
    then
  • DShop.Services.Products.Handlers.BrowseProductsHandler.BrowseProductsHandler(…)

which is as expected,
Sorry for confusion, I must have missed something the first try.