Skip to main content

Notification Commands

Summary

The Notification Service does not implement a formal command object model or CQRS command handlers. Write operations (“commands” in the conceptual sense) are performed inline by the dispatcher and by Minimal API endpoint handlers that mutate entities directly through the DbContext.

Verified write operations

OperationWhere implementedEffect (verified)
Dispatch an eventNotificationDispatcher.DispatchAsyncUpserts recipient, creates messages, records attempts, marks processed, writes audit
Retry a messageNotificationDispatcher.RetryMessageAsync and /notifications/{id}/retryResets message to Pending and re-runs delivery
Mark a notification readPOST /notifications/{id}/readSets status Read, ReadOnUtc, writes a Read audit row
Create a template versionPOST /notification-templatesInserts the next Version for a (tenant, key, channel)
Update a templatePUT /notification-templates/{id}Applies supplied fields in place
Test-render / live-send a templatePOST /notification-templates/{id}/testRenders and optionally persists a message and one delivery attempt
Publish/dispatch a test eventPOST /notifications/test/dispatch and /test/publishDrives the pipeline or the broker for verification

Write model

Each write handler validates minimal inputs, mutates tracked entities and calls SaveChangesAsync. There is no command bus, no handler registration and no command validation pipeline; guards are inline (for example, required templateKey/channel and a known-channel check).

Verified absence

There are no *Command classes, no ICommandHandler, no MediatR requests and no unit-of-work abstraction. SaveChangesAsync on NotificationDbContext is the transaction boundary for each write.

Requires Confirmation

Whether a command abstraction is planned for consistency with other services requires confirmation.

Source References

  • microservices/src/notification-service/Api/NotificationEndpoints.cs
  • microservices/src/notification-service/Application/NotificationDispatcher.cs

See Also

Keywords

Commands, write operations, mutations, endpoints, verified absence.

Revision Information

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