-
Notifications
You must be signed in to change notification settings - Fork 2
templates microservice
Since microservice based solutions are composed from a number of smaller independent services, a .NET solution template has been created. The solution's structure is based on the following resource:
.NET Microservices: Architecture for Containerized .NET Applications
The template creates a solution consisting of the following projects:
- Domain: Contains the application's domain model and logic.
- App: Contains the application business services, event-handlers, command-handlers, and query-handlers.
- Infra: Contains any implementation specific classes such as repositories or calls to external services.
- WebApi: The host application providing a Web Api.
- Tests: XUnit based test project.
The following contains an overview of the microservice template.
The template is installed from a NuGet package and is executed at the command line. Execute the following to install the template:
dotnet new install NetFusion.Templates
[IMAGE]
The microservice template has the following arguments:
- Port (-p, --port): The port one which the service will listen for requests when executed
Complete the following to create a new microservice based solution:
- Create a directory with the name of your microservice.
mkdir Auto.Recalls
- Navigate into the directory that will contain the microservice's code and run the following:
cd Auto.Recalls
dotnet new netfusion-microservice --port 6200
- Build microservice:
dotnet build ./src
Following is the created solution:
[IMAGE]
The created microservice solution is configured to send all Serilog generated logs to SEQ. The following can be executed to run SEQ within Docker. If you don't have Docker installed, the service will still start but an exception will be written if a connection could not be made or the SEQ related code within the Program.cs can be removed if desired. The code generated from the template has a docker-compose.yml file that can be used to run SEQ in Docker.
cd Auto.Recalls/seq/
docker-compose up -d
Execute the following within the Auto.Recalls.WebApi directory:
cd Auto.Recalls/src/Auto.Recalls.WebApi/
dotnet run
[IMAGE]
The SEQ Web Client running in Docker can be access at the following URL: http://localhost:8051
[IMAGE]
When the service is running in Development, a request can be made to the following URL to view the plugins from which the microservice has been composed:
http://localhost:6200/mgt/composite/log
[IMAGE]
The following can be executed to remove the NetFusion.Templates NuGet package temples and remove SEQ and its data from Docker:
dotnet new uninstall NetFusion.Templates
cd Auto.Recalls/seq/
docker-compose down
docker volume rm dev-seq_data
-
Templates
-
Resources
-
Bootstrapping
-
Modules Details
-
Settings
-
Validation
-
Monitoring
- Setup
- Commands
- Queries
- Domain Events
- Message Logs
- Message Publishers
- Message Enrichers
- Message Filters
-
Azure Service Bus
-
RabbitMQ
-
Redis
-
MongoDB