Last modified: Jun 5, 2024

Notifications email

Integrations

Kafka

The Notifications email microservice has an integration towards a Kafka broker, and this integration is used both to publish and consume messages from topics relevant to the microservice.

Consumers:

The following Kafka consumers are defined:

Producers:

A single producer KafkaProducer is implemented and used by all services that publish to Kafka.

Please reference the Kafka architecture section for a closer description of the Kafka setup.

Azure Communication Services

Azure’s email service Communication Services Email is used to send the email to the end users. A client, EmailServiceClient has been implemented based on the SDK made available by Microsoft to interact with their API.

Dependencies

The microservice takes use of a range of external and Altinn services as well as .NET libraries to support the porivded functionality. Find descriptions of key dependencies below.

External Services

ServicePurposeResources
Apache Kafka on Confluent CloudHosts the Kafka brokerDocumentation
Azure Communication servicesSends out emails to recipients and reports backDocumentation
Azure MonitorTelemetry from the application is sent to Application InsightsDocumentation
Azure Key VaultSafeguards secrets used by the microserviceDocumentation
Azure Kubernetes Services (AKS)Hosts the microservice and cron jobsDocumentation

Altinn Services

ServicePurposeResources
Altinn Notifications*Service that orchestrates the sending of notifications.Repository

*Functional dependency to enable the full functionality of Altinn Notifications. Altinn Notifications generates the emails that are to be sent through this email service.

.NET Libraries

Notifications microservice takes use of a range of libraries to support the provided functionality.

LibraryPurposeResources
Azure.Communication.EmailInteract with Communication services APIRepository, Documentation
Confluent.KafkaIntegrate with kafka brokerRepository, Documentation

A full list of NuGet dependencies is available on GitHub.

Testing

Quality gates implemented for a project require an 80 % code coverage for the unit and integration tests combined. xUnit is the framework used and the Moq library supports mocking parts of the solution.

Unit tests

The unit test project is available on GitHub.

Integration tests

The integration test project is available on GitHub.

There is a single dependency for the integration tests. Remaining dependencies such as Azure Communication Services have been mocked.

  • Kafka server.

    A YAML file has been created to easily start all Kafka-related dependencies in a Docker containers.

Automated tests

No automated tests are set up for this component as it is considered that the integrations and availability are implicitly tested through automated tests on the orchestrating service, Altinn Notifications.

Use case tests

No use case tests are set up for this component as it is considered that the integrations and availability are implicitly tested through use case tests on the orchestrating service, Altinn Notifications.

Hosting

Web API

The microservice runs in a Docker container hosted in AKS, and it is deployed as a Kubernetes deployment with autoscaling capabilities.

The notifications email application runs on port 5091.

See DockerFile for details.

Build & deploy

Web API

Run on local machine

Instructions on how to set up the service on local machine for development or testing is covered by the README in the repository.