Skip to main content

Notification Application Layer

Summary

The application layer is a small set of collaborating services behind interfaces declared in Abstractions.cs: the dispatcher, the resolver, the template engine, the preference evaluator, the retry policy and the channel-sender registry. It contains the orchestration logic; there is no command/query object model.

Dependency graph

Services and abstractions

AbstractionImplementationLifetimeRole
INotificationDispatcherNotificationDispatcherscopedEnd-to-end orchestration and manual retry
IEventNotificationResolverEventNotificationResolversingletonEvent payload → notification intents
ITemplateEngineTemplateEnginescopedTemplate resolution and rendering
IPreferenceEvaluatorPreferenceEvaluatorscopedOpt-out preference decision
RetryPolicyRetryPolicysingletonBackoff schedule
IChannelSenderRegistryChannelSenderRegistrysingletonChannel → sender resolution

Records and results

Abstractions.cs also declares the immutable records that flow through the layer: ResolvedRecipient, NotificationIntent, RenderedTemplate, SendContext, DispatchResult and the DispatchOutcome enum.

Request flow

Both entry points — the event consumer and the API test/retry endpoints — call INotificationDispatcher. The dispatcher composes the resolver, preference evaluator, template engine, sender registry and retry policy, persisting messages, attempts and audit rows through the DbContext.

Error handling

Failures are localized: a null/invalid payload yields no intent; a missing template audits TemplateMissing and continues; a channel with no address is suppressed; delivery exceptions are caught per attempt and retried; and an unhandled consumer error requeues the broker message. The dispatcher does not throw to the caller on ordinary per-channel failures.

Verified absence

There is no MediatR, no command/query handler pipeline, no validation pipeline behavior and no application-service base class. Orchestration is direct method calls.

Requires Confirmation

Whether a command/query abstraction is planned requires confirmation; the current design is a direct service model.

Source References

  • microservices/src/notification-service/Application/Abstractions.cs
  • microservices/src/notification-service/Application/NotificationDispatcher.cs
  • microservices/src/notification-service/Application/TemplateEngine.cs
  • microservices/src/notification-service/Application/PreferenceEvaluator.cs

See Also

Keywords

Application layer, services, abstractions, dependency graph, request flow.

Revision Information

  • Status: Draft
  • Last reviewed: 2026-07-21
  • Next review: 2026-10-21