Home

Awesome

ASCLAB .NET Core PoC - LAB Insurance Sales Portal

BuiltWithDot.Net shield

This is an example of a very simplified insurance sales system made in a microservice architecture using:

Comprehensive guide describing the architecture, applied design patterns and technologies can be found on our blog:

Other articles around microservices that could be interesting:

Business Case

We are going to build very simplified system for insurance agents to sell various kind of insurance products. Insurance agents will have to log in and system will present them with list of products they can sell. Agents will be able to view products and find a product appropriate for their customers. Then they can create an offer and system will calculate a price based on provided parameters.
Finally agent will be able to confirm the sale by converting offer to policy and printing pdf certificate.
Portal will also give them ability to search and view offer and policies.
Portal will also have some basic social network features like chat for agents.
Latest feature is a business dashboard that displays sales stats using ElasticSearch Aggregations and ChartJS.

Architecture overview

<p align="center"> <img alt="NET Microservices Architecture" src="https://raw.githubusercontent.com/asc-lab/dotnetcore-microservices-poc/master/readme-images/dotnetcore-microservices-architecture.png" /> </p>

Each business microservice has also .Api project (PaymentService.Api, PolicyService.Api etc.), where we defined commands, events, queries and operations and .Test project (PaymentService.Test, PolicyService.Test) with unit and integration tests.

Running with Docker

You must install Docker & Docker Compose before.
Scripts have been divided into two parts:

You can use scripts to build/run/stop/down all containers.

To run the whole solution:

cd scripts
./infra-run.sh
./app-run.sh

If ElasticSearch fails to start, try running sudo sysctl -w vm.max_map_count=262144 first

Once the application and infrastructure are started you can open http://localhost:8080 in your browser and see our welcome page. Once there you can use Account menu item to log into the system. Valid users and passwords can be found here. You can for example login as admin with password admin.

Manual running

Prerequisites

Install PostgreSQL version >= 10.0.

Install RabbitMQ.

Install Elasticsearch version >= 6.

Init databases

Windows

cd postgres
"PATH_TO_PSQL.EXE" --host "localhost" --port EXAMPLE_PORT --username "EXAMPLE_USER" --file "createdatabases.sql"

In my case this command looks like:

cd postgres
"C:\Program Files\PostgreSQL\9.6\bin\psql.exe" --host "localhost" --port 5432 --username "postgres" --file "createdatabases.sql"

Linux

sudo -i -u postgres
psql --host "localhost" --port 5432 --username "postgres" --file "PATH_TO_FILE/createdatabases.sql"

This script should create lab_user user and the following databases: lab_netmicro_payments, lab_netmicro_jobs, lab_netmicro_policy and lab_netmicro_pricing.

Run Eureka

Service registry and discovery tool for our project is Eureka. It is included in the project. In order to start it open terminal / command prompt.

cd eureka-server
./gradlew.[bat] bootRun

This should start Eureka and you should be able to go to http://localhost:8761/ and see Eureka management panel.

Build

Build all projects from command line without test:

Windows

cd scripts
build-without-tests.bat

Linux

cd scripts
./build-without-tests.sh

Build all projects from command with test:

Windows

cd scripts
build.bat

Linux

cd scripts
./build.sh

Run specific service

Go to folder with specific service (PolicyService, ProductService etc) and use dotnet run command.