feat: consume transactional email notifications

Add contract validation, SMTP delivery results, terminal failure context, neutral development seeding, and local Docker setup.

Ref: IT-1033
This commit is contained in:
2026-08-04 12:32:28 +03:00
parent b8435ac07b
commit 2757869176
37 changed files with 1465 additions and 122 deletions
+1
View File
@@ -7,3 +7,4 @@ RABBITMQ_PASSWORD=guest
RABBITMQ_AMQP_PORT=5672
RABBITMQ_MANAGEMENT_PORT=15672
WEB_PORT=5200
DEVELOPMENT_EMAIL_SERVICE_NAME=TestService
@@ -3,7 +3,9 @@ name: hrynco-notification-service
services:
migrator:
environment:
- DOTNET_ENVIRONMENT=Development
- App__ConnectionString=Host=db;Port=5432;Database=notification_service;Username=postgres;Password=postgres
- DevelopmentSeed__ServiceName=${DEVELOPMENT_EMAIL_SERVICE_NAME:-TestService}
web:
environment:
@@ -29,9 +31,6 @@ services:
environment:
RABBITMQ_DEFAULT_USER: guest
RABBITMQ_DEFAULT_PASS: guest
ports:
- "5672:5672"
- "15672:15672"
networks:
- internal
@@ -55,10 +54,17 @@ services:
networks:
- internal
mailpit:
image: axllent/mailpit:v1.30.0
ports:
- "8025:8025"
networks:
- internal
volumes:
pgdata:
name: ns-dev-pgdata
rabbitmq_data:
name: ns-dev-rabbitmq-data
seq_data:
name: ns-dev-seq
name: ns-dev-seq
+2 -1
View File
@@ -40,6 +40,7 @@ services:
- App__RabbitMq__Port=5672
- App__RabbitMq__User=${RABBITMQ_USER:?RABBITMQ_USER is required}
- App__RabbitMq__Password=${RABBITMQ_PASSWORD:?RABBITMQ_PASSWORD is required}
- App__RabbitMq__VirtualHost=${RABBITMQ_VIRTUAL_HOST:-/}
depends_on:
db:
condition: service_healthy
@@ -92,4 +93,4 @@ volumes:
networks:
internal:
driver: bridge
driver: bridge
@@ -0,0 +1,72 @@
@echo off
setlocal
set "SCRIPT_DIR=%~dp0"
for %%I in ("%SCRIPT_DIR%..\..") do set "REPOSITORY_ROOT=%%~fI"
set "ENV_FILE=%SCRIPT_DIR%.env.Development"
set "BASE_COMPOSE=%SCRIPT_DIR%docker-compose.yml"
set "DEVELOPMENT_COMPOSE=%SCRIPT_DIR%docker-compose.Development.yml"
where docker >nul 2>&1
if errorlevel 1 goto docker_missing
docker info >nul 2>&1
if errorlevel 1 goto docker_unavailable
if not exist "%ENV_FILE%" goto environment_missing
pushd "%REPOSITORY_ROOT%"
if errorlevel 1 goto repository_unavailable
echo Validating the development Docker Compose configuration...
docker compose --env-file "%ENV_FILE%" -f "%BASE_COMPOSE%" -f "%DEVELOPMENT_COMPOSE%" config --quiet
if errorlevel 1 goto compose_invalid
if /i "%~1"=="--validate-only" goto validation_complete
echo Building and starting the Notification Service development environment...
docker compose --env-file "%ENV_FILE%" -f "%BASE_COMPOSE%" -f "%DEVELOPMENT_COMPOSE%" up --build -d
if errorlevel 1 goto installation_failed
echo.
docker compose --env-file "%ENV_FILE%" -f "%BASE_COMPOSE%" -f "%DEVELOPMENT_COMPOSE%" ps
echo.
echo Notification Service development environment is running.
echo Admin: http://localhost:5200/admin/channels
echo RabbitMQ: http://localhost:15672
echo Mailpit: http://localhost:8025
echo Seq: http://localhost:5342
echo.
popd
exit /b 0
:validation_complete
echo Development Docker Compose configuration is valid.
popd
exit /b 0
:compose_invalid
echo ERROR: The development Docker Compose configuration is invalid.
popd
exit /b 1
:installation_failed
echo ERROR: Failed to build or start the development environment.
popd
exit /b 1
:docker_missing
echo ERROR: Docker CLI was not found. Install and start Docker Desktop, then run this script again.
exit /b 1
:docker_unavailable
echo ERROR: Docker is installed, but the Docker engine is not available. Start Docker Desktop and try again.
exit /b 1
:environment_missing
echo ERROR: Development environment file was not found: "%ENV_FILE%"
exit /b 1
:repository_unavailable
echo ERROR: Repository root is not available: "%REPOSITORY_ROOT%"
exit /b 1