Altinn platform microservice for handling notifications (mail, sms, etc) This component handles the functionality related to registering and sending notifications.
Detailed architecture documentation can be found in the docs/architecture folder.
This is a backend WebAPI solution written in .NET / C# following the clean architecture principles. The solution is into four projects, each with their associated test project.
The API layer that consumes services provided by Altinn.Notifications.Core
Relevant implementations:
- Controllers
- Program.cs
The domain and application layer that implements the business logic of the system.
Relevant implementations:
- Interfaces for external dependencies implemented by infrastructure and repository layer
- Domain models
- Services
The infrastructure layer that implements the interfaces defined in Altinn.Notifications.Core for integrations towards 3rd-party libraries and systems.
Relevant implementations:
- Kafka producer and consumer implementation
- Clients for communicating with Altinn Platform components
The persistance layer that implements repository logic.
- .NET 9.0 SDK
- Newest Git
- A code editor - we like Visual Studio Code
- Also install recommended extensions (e.g. C#)
- Podman or another container tool such as Docker Desktop
- PostgreSQL
- pgAdmin
Ensure that both PostgreSQL and pgAdmin have been installed and start pgAdmin.
In pgAdmin
- Create database notificationsdb
- Create the following users with password: Password (see privileges in parentheses)
- platform_notifications_admin (superuser, canlogin)
- platform_notifications (canlogin)
- Create schema notifications in notificationsdb with owner platform_notifications_admin
A more detailed description of the database setup is available in our developer handbook
Clone Altinn Notifications repo and navigate to the folder.
git clone https://github.com/Altinn/altinn-notifications
cd altinn-notifications
Ensure that Docker has been installed and is running.
In a terminal navigate to the root of this repository
and run command podman compose -f setup-kafka.yml up -d
Kafdrop is now available at http://localhost:9000.
The Notifications components can be run locally when developing/debugging. Follow the install steps above if this has not already been done.
-
Navigate to src/Altinn.Notifications, and build and run the code from there, or run the solution using you selected code editor
cd src/Notifications dotnet run
The notifications solution is now available locally at http://localhost:5090/. To access swagger use http://localhost:5090/swagger.
There is a Bruno (https://www.usebruno.com/) collection in <project root>/test/bruno
with examples and testcases for the API.
Before running any tests, remember to prepare an .env
file. See <project root>/test/bruno/.env.sample
for an example of how to set it up.
The swagger generated by the application differs from what is published in the documentation and used in APIM. See transformations for the steps to generate these artifacts.