concept microservice platform in category .net

appears as: The microservice platform, microservice platform
Microservices in .NET Core: with examples in Nancy

This is an excerpt from Manning's book Microservices in .NET Core: with examples in Nancy.

Figure 11.1. The microservice platform is a collection of packages implementing the technical concerns that cut across all microservices. The platform is installed in—and thus becomes part of—every microservice.

These are the platform areas I’ve chosen to cover for this book, but they aren’t necessarily the things you’ll need in a microservice platform for your system. I’ve tried to include common components. In particular, I think such platforms should include the monitoring, correlation token, request/response-logging, and performance-logging bits. They don’t have to be in the exact form used in this book—you may, for instance, prefer a different correlation token format or another logging framework. Your authorization middleware will be tied to the approach you choose to use for security between microservices; but if you choose to put security measures in place around microservice collaboration, libraries supporting that should be included in your microservice platform.

MicroserviceNET.Platform brings in the other two NuGet packages in the microservice platform—MicroserviceNET.Logging and MicroserviceNET.Auth—as well as Serilog and Nancy. In other words, MicroserviceNET.Platform brings in everything you need to build a microservice.

The next step is to configure the microservice platform. You do so in the Startup class by calling a couple of convenience methods, setting up Serilog, and creating a simple health check.

Example 11.12. Configuring the microservice platform in the Startup class

With this done, the microservice platform is configured and ready to run. This is all it takes to create a new microservice—from here on, it’s a matter of adding behavior. The last step in creating your Hello World microservice is to add a Nancy module with a single endpoint that makes a request to another microservice and sends the response back to the caller (see listing 11.14). This isn’t much of a behavior for a microservice, but it serves as an illustration of how the microservice platform works with regard to outgoing requests: the request to the other microservice has both a correlation token and an access token added to it by the microservice platform.