Notification Delivery Pipeline
Summary
DeliverWithRetryAsync delivers a single created message. It resolves the channel’s sender, then loops up to the retry policy’s maximum attempts, recording a delivery-attempt row on every try and updating the message status to Sent or Failed.
Delivery flow
Sender resolution
If the registry has no sender for the message channel, the message is marked Failed immediately with a descriptive LastError and a DeliveryFailed audit row — no attempts are made.
Attempt recording
Each try appends a NotificationDeliveryAttempt capturing attempt number, channel, provider, Success/Failed status, an optional truncated error, start/complete timestamps and elapsed milliseconds. The message’s Attempts counter is updated per try.
Success and failure states
On success the message becomes Sent with SentOnUtc set and LastError cleared. On the final failed attempt the message becomes Failed and a warning is logged. Cancellation during a delay returns without further attempts.
Manual retry
RetryMessageAsync re-runs this pipeline for an existing message: it resets the message to Pending, clears the error, rebuilds the recipient (falling back to the stored address) and re-enters DeliverWithRetryAsync. ForceFail is never set on a manual retry.
Failed-message visibility
Messages that exhaust delivery are queryable through the /notifications/failed endpoint, and per-message attempts through /notifications/{id}/attempts.
Verified absence
There is no asynchronous delivery queue, no separate DeliveryProcessor worker and no cross-message batching. Delivery runs inline within the dispatch scope.
Requires Confirmation
Whether failed messages are intended to be re-driven automatically (versus manual retry) requires confirmation.
Source References
microservices/src/notification-service/Application/NotificationDispatcher.csmicroservices/src/notification-service/Channels/ChannelSenderRegistry.csmicroservices/src/notification-service/Domain/NotificationEntities.cs
Related Articles
See Also
Keywords
Delivery, sender, attempt, failure handling, message status, manual retry.
Revision Information
- Status: Draft
- Last reviewed: 2026-07-21
- Next review: 2026-10-21