concept Special Offers microservice in category .net

appears as: Special Offers microservice, Special Offers microservices
Microservices in .NET Core, Second Edition

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

Figure 4.6. Product data flows from the ERP system to the Product Catalog microservice. The protocol used to get product information from the ERP system is defined by the ERP system. It could expose a SOAP web service for fetching the information, or it might export product information to a proprietary file format.
ch04 fig 06 horsdal2

Let’s assume that you aren’t in a position to make changes to the ERP system, so the integration must be implemented using whatever interface the ERP system has. It might use a SOAP web service to fetch product information, or it might export all the product information to a proprietary file format. In either case, the integration must happen on the ERP system’s terms. Depending on the interface the ERP system exposes, this may be a smaller or larger task. In any case, it’s a task primarily concerned with the technicalities of integrating with some other system, and it has the potential to be at least somewhat complex. The purpose of this integration is to support the Product Catalog microservice.

The collaboration between two microservices can use one, two, or all three of these collaboration styles. Each time two microservices need to collaborate, you must decide which style to use. Figure 5.2 shows the collaborations of Loyalty Program again, but this time identifying the collaboration style I chose for each one.

Figure 5.9. The event subscription in the Loyalty Program microservice is handled in a event-subscriber process.
ch05 fig 9 horsdal2

The event-subscriber process is a background process that periodically makes requests to the event feed on the Special Offers microservice to get new events. When it gets back new events, it processes them by sending commands to the Notifications microservice to notify registered users about new special offers. The SpecialOffersSubscriber component is where the polling of the event feed is implemented, and the Notifications-Client component is responsible for sending the command to Notifications. The rate a which the event subscribes gets events can differ quite a bit based on the specific use case. Often events are fetched every 30 seconds or every few mintues, but there are also cases where fetching events very often, like every second, or where fetching events very seldom, like every hour, is the right thing to do.

> docker build . -t loyalty-programn