- A classic DDD with CQRS-ES, Hypermedia API and Ubiquitous unit test project based on EventFlow. It's targeted to ASP.NET Core 2.2 and can be deployed to docker and k8s.
- Based on EventFlow
- Based .NET Core2.2, plan to migrate .NET Core3.1 after EventFlow was fixed
- Implement read model by EntityFramework, MongoDB, Elasticsearch
- Integrate RabbitMQ and used MassTransit as Message bus (in progress)
- Event driven MicroService integration (in progress)
- Wiki is in progress
Then spin up a new container using docker-compose
docker-compose up
Note: add a -d
to run the container in background
An API service and mssql will run in docker
This project based on .NET Core SDK 2.2.103, please install corresponding SDK for your operating system:
After installing, please run below command to make sure current .NET Core version is 2.2.103
dotnet --version
The EventStore and ReadModel are based on EF Core and connect to MSSQL, before run this service please update EventStore connect string and
ReadModel connect string in settings.json
under RestAirline.Api
project.
After set connect string two database will be migrated automatically by the API service.
Journey items should come from another micro-service named flight availability, for now let's build a journey in the api automatically for convenience. So you need not pass any journey id to this api.
POST api/booking/journeys
We can get request body schema from last Api response become the whole Api is designed by Hypermedia.
The api definition is totally described by last api response under resourceCommands\addPassengerCommand
:
"addPassengerCommand":
{
"bookingId": "booking-352cb1f3-0f68-4e04-a2f7-24036eb53ce7",
"name": null,
"passengerType": 0,
"age": 0,
"email": null,
"postUrl": {
"uri": "/api/booking/booking-352cb1f3-0f68-4e04-a2f7-24036eb53ce7/passenger"
}
}
Obviously the endpoint is:
http://localhost:61100/api/booking/booking-352cb1f3-0f68-4e04-a2f7-24036eb53ce7/passenger
The payload schema is:
{
"bookingId": "booking-352cb1f3-0f68-4e04-a2f7-24036eb53ce7",
"name": null,
"passengerType": 0,
"age": 0,
"email": null,
}
bookingId
is filled already, please try to fill other parameters, eg:
{
"bookingId": "booking-352cb1f3-0f68-4e04-a2f7-24036eb53ce7",
"name": "test",
"passengerType": 0,
"age": 22,
"email": "[email protected]",
}
Send request:
POST api/{bookingId}/passenger
According to response of last api, you can either get the booking by resourceLinks
or post data by resourceCommand
.
GET api/booking/{bookingId}
The example is regarding online booking for an airline company. An airline company named 'RestAirline' is offering online booking.
- After passenger submitted one of the available journey that means this passenger starting create an online booking.
- passenger can submit multiple available journeys, every journey including a flight.
- After passenger added journeys, he/she can add passengers.
- Once passenger have been added in booking, passenger can update passenger name for each passenger.
- passenger can submit available seats for each flight and each passenger, seat may just including seat number.
- Once passenger submitted seats, passenger still can update seat.
- After all of these steps, passenger have a chance to order insurance for all passenger some of them.
- Last step is pay for all booking, if payment is successful then create a pnr(six digit) for this booking.
- Online checkin is allowed for all the flights. Passenger can checkin at below time window:
2h <= timeWindow <= departure time - 30m
- Passenger can do online checkin, after this step passenger start to his/her journey.
There are four possible Domains for above business:
But let's focus on Booking
for now and mock other two domains even if you can hardcode data from these two domains.