This is a solution for processing high-traffic lightning strikes data and creating notifications when a strike happens within a region of an asset. It has both API to be used publicly or HostedService to consume and process large files. Also the solution supports persistence for both asset info and lightning strike records. It's extensible with the dispatcher mechanism that supports application events.
ASP.NET Core 5 Entity Framework Core 5 FluentValidation Serilog xUnit, FluentAssertions, Bogus
The easiest way to get started is to follow these instructions to get the project up and running:
You will need the following tools:
- JetBrains Rider (version 2021.1.5 or later) or Visual Studio 2019 (version 16.10.4 or later)
- .NET 5
Follow these steps to get your development environment set up:
- Clone the repository
- At the root directory, restore required packages by running:
dotnet restore
- Next, build the solution by running:
dotnet build
- Once the solution has been built, within the
\src\HostedService
directory, launch the hosted service by running:dotnet run
- Alternatively, API can be started within the
\src\API
directory, by running:dotnet run
- Sample curl command can be used to test after running the API project:
curl --location --request POST 'http://localhost:5000/lightning-strikes' --header 'Content-Type: application/json' --data-raw '{ "flashType": 1, "strikeTime": 1446760902510, "latitude": 8.7020156, "longitude": -12.2736188, "peakAmps": 3034, "reserved": "000", "icHeight": 11829, "receivedTime": 1446760915181, "numberOfSensors": 6, "multiplicity": 1 }'
This will contain all entities, enums, exceptions, interfaces, types and logic specific to the domain layer.
This layer contains all application logic. It is dependent on the domain layer, but has no dependencies on any other layer or project. This layer defines interfaces that are implemented by outside layers. For example; if the application need to access another service, a new interface would be added to application and an implementation would be created within the infrastructure.
This layer contains classes for accessing external resources such as file systems, web services, smtp, and so on. These classes should be based on interfaces defined within the application layer.
This layer is a web api application based on ASP.NET Core 5. This layer depends on both the Application and Infrastructure layers, however, the dependency on Application is only to support dependency injection.
This project is not a conventional layer of a 'clean architecture' approach. However, the purpose of the project is to provide a mechanism to mimic, for example sensors or other IOT devices and demonstrate the behavior of the application/services under high-traffic requests. This service is configurable.