concept Product Catalog microservice in category .net

appears as: The Product Catalog microservice, Product Catalog microservice
Microservices in .NET Core, Second Edition MEAP V04

This is an excerpt from Manning's book Microservices in .NET Core, Second Edition MEAP V04.

The fact that each microservice owns its own data store makes it possible to use different database technologies for different microservices depending on the needs of each microservice. The Product Catalog microservice, for example, might use SQL Server to store product information; the Shopping Cart microservice might store each user’s shopping cart in Redis; and the Recommendations microservice might use an ElasticSearch index to provide recommendations. The database technology chosen for a microservice is part of the implementation and is hidden from the view of other microservices.

Figure 2.8. ProductCatalogClient
ch02 fig 08 horsdal2

The Product Catalog microservice and the Shopping Cart microservice are separate microservices running in separate processes, perhaps even on separate servers. Product Catalog exposes an HTTP API that Shopping Cart uses. Product catalog information is fetched in HTTP GET requests to an endpoint on the Product Catalog microservice.

Listing 2.12. Microservice error-handling policy
language="sql" linenumbering="unnumbered">  services.AddHttpClient<ProductCatalogClient>()
    .AddTransientHttpErrorPolicy(p =>         #1
      p.WaitAndRetryAsync(                    #2
        3,
        attempt => TimeSpan.FromMilliseconds(100*Math.Pow(2, attempt))));
sitemap

Unable to load book!

The book could not be loaded.

(try again in a couple of minutes)

manning.com homepage
test yourself with a liveTest