Skip to main content
Version: Next

Delivery Log

The Hermodr.Publisher.DeliveryLog package records operational telemetry for every event publish attempt: which channel was used, when the attempt happened, how many times it was retried, how long it took, whether it succeeded or failed, and what error occurred.

Why Use the Delivery Log?

The existing Dead-Letter Channel captures only failed events and preserves them for replay. The Audit Trail (planned) records domain facts — the event payloads themselves — for auditing and read-model rebuilding. Neither answers operational questions about the publishing infrastructure:

  • How many times did we attempt to send event X before it succeeded?
  • Which channel is producing the most failures?
  • What was the average delivery latency last week?
  • Did a specific subscriber receive all events during an outage window?

The Delivery Log fills this gap. It records structured, queryable telemetry about every delivery attempt — successes, failures, retries — so you can monitor publish health, compute SLAs, and debug delivery issues without relying on broker-specific dashboards or generic application logs.

Architecture

IEventPublisher


[Middleware Pipeline]

├── DeliveryLogMiddleware
│ captures start time → calls next → writes outcome + elapsed


Channel publish

├── success ──► record Succeeded

└── failure ──► middleware records Failed (re-throws exception)

└── DeliveryLogPublishErrorHandler (optional)
records failure for ThrowOnErrors=false path

Core Types

The feature is built on three types, each with a focused responsibility:

IEventPublishDeliveryLog

The write-only surface. It exposes a single method:

public interface IEventPublishDeliveryLog
{
Task RecordAsync(EventDeliveryRecord record, CancellationToken cancellationToken = default);
}

The middleware depends on this interface, which keeps it decoupled from query capabilities.

EventDeliveryRecord

The concrete data contract for one delivery attempt. It carries:

  • The event itself
  • Publisher metadata
  • Attempt number
  • Timestamp
  • Outcome (Succeeded, Failed, Retried)
  • Error details (type, message)
  • Elapsed time

EventDeliveryOutcome

Three-state enum:

ValueMeaning
SucceededDelivered without exception
FailedTerminal failure
RetriedFailure with retry scheduled (reserved for future retry infrastructure)

Next Steps

PageDescription
InstallationInstall packages
MiddlewareHow DeliveryLogMiddleware works
Error HandlerCapture failures on error path
RegistrationWire up in DI
Storage BackendsIn-Memory, NDJSON, EF Core comparison
NDJSON BackendDetailed NDJSON configuration
EF Core BackendDetailed EF Core configuration
Comparisonvs dead-letter, vs audit trail