Skip to content

Notification System Overview

The Notification system is the central service and shared package set used by Microtec services to send, store, query, and operate user-facing notifications.

It has three major parts:

PartResponsibility
Microtec.Notifications.ContractsShared DTOs, payloads, enums, metadata keys, and integration events.
Microtec.Notifications.ClientConsumer-facing client, fluent builders, delivery strategies, proxy controllers, and admin clients.
InfrastructureServices/NotificationsThe actual Notification service: APIs, orchestration, providers, persistence, jobs, and admin operations.

Architecture

Request Paths

Delivery Modes

ModeContract enumBehavior
HTTPDeliveryMode.HttpThe client posts directly to the Notification service and receives a NotificationId when the service persisted and attempted the send.
QueueDeliveryMode.QueueThe client publishes SendNotificationEvent. The service consumes it asynchronously. The client receives publish success, not provider delivery success.

Use HTTP when the caller needs immediate send feedback, for example OTP-like flows. Use queue mode when the caller should not block on provider latency or when high throughput matters more than immediate feedback.

Channel Selection

The service selects the channel by the concrete payload type:

Payload typeChannel
EmailPayloadNotificationChannelType.Email
SmsPayloadNotificationChannelType.SMS
PushPayloadNotificationChannelType.PushNotification
WhatsAppPayloadNotificationChannelType.WhatsApp

The entry point is NotificationOrchestrator.SendAsync(NotificationPayload payload, CancellationToken ct).

Runtime Context

The notification service uses request context to select tenant or source-system configuration:

HeaderConstantPurpose
ClientIdNotificationHeaderNames.ClientIdIdentifies the calling client.
InternalApiKeyNotificationHeaderNames.InternalApiKeyInternal API key header.
X-Correlation-IdNotificationHeaderNames.CorrelationIdCross-service trace correlation.
X-SubdomainNotificationHeaderNames.SubdomainTenant context for tenant-specific channel configs.
X-User-IdNotificationHeaderNames.UserIdCurrent user context, required by user-specific operations.
X-Source-SystemNotificationHeaderNames.SourceSystemSystem-sender context where Subdomain can be omitted.

The client package sets these headers through TenantHeaderDelegatingHandler.

Tenant vs Source-System Configuration

The service has two configuration paths:

PathHow it is selectedChannel config rule
TenantX-Subdomain or payload Subdomain is present and no source system is used.Match NotificationChannelConfig.Subdomain and require SourceSystem == null.
Source systemX-Source-System or payload SourceSystem is present.Match NotificationChannelConfig.SourceSystem and require Subdomain == null.

This allows a system sender to send without tenant subdomain, while tenant-specific sends remain isolated.

Status Model

The system tracks two levels of status:

LevelEntityMeaning
RequestNotificationRequestThe logical notification attempt. Stores original payload JSON, channel, subdomain, user, status, retry count, metadata, and timestamps.
DeliveryNotificationDeliveryOne provider-recipient attempt. Stores recipient identifier, provider, provider message id, provider request and response payloads, and delivery status.

See Flow, persistence, and retry for the full lifecycle.

Internal Documentation — Microtec