A reusable microservices platform can help developers jumpstart the development process by providing reusable components that they can use to build new …
Join the DZone community and get the full member experience. Development teams frequently need to build new microservices to either add new functionality or replace existing microservices. However, microservices must support some standard features such as providing insight into their health through logging, allowing monitoring, and following the organization’s security standards. A reusable microservices platform can help developers jumpstart the development process by providing reusable components that they can use to build new microservices. To implement a reusable microservices platform, you can use the sidecar pattern or build NuGet packages that are installed in every microservice. Monitoring, tracing, and logging are the key components that must exist in your platform. We will cover an implementation of the platform consisting of the three components in this article. However, you may build many more platform components to implement standard technical policies such as handling database connections, retries, timeouts, etc. At this point, a question that you might be thinking about is how much should you include in your platform? Although there is no standard answer to the question, consider the following points when you need to decide whether to add a feature to the platform: Try to hit the sweet spot between implementing cross-cutting concerns and the ability to roll out platform changes incrementally. Such platform implementation will ensure that the developers can focus on the business logic and not worry about the cross-cutting concerns, and you can evolve the platform without disrupting the development teams. Now that we understand that there is more to creating a new microservice than just creating a new, empty ASP. NET Core project, we will build the following three components that will be available to every microservice across our organization: Our goal is to standardize the cross-cutting features and enable the developers to use the platform components with minimal effort. A new microservice will only have to install the custom NuGet package Microservice. Platform and a little startup code to use the platform. As I said before, don’t feel bound by the scope of this implementation, and identify the areas that you want to standardize across your microservices. For example, you might want to standardize how personal information is redacted from the logs, how output caching is handled, how database connections are handled, and so on. Please see the source code of the microservices platform for your reference. We will discuss the implementation of the platform components in the next section. We will use Serilog to implement the logging component. Serilog is a structured logging library for. NET. Serilog enrichers are used for enriching the log events with additional information. Enrichers can be specified using the Enrich. With fluent API of the Serilog LoggerConfiguration. We will use the following enrichers in our implementation: Create a. NET Core class library named Microservices. Platform and add the NuGet packages Microsoft. Extensions. Hosting, Serilog.
Home
United States
USA — software 3 Fundamental Components of a Reusable. NET Microservices Platform