Path: redb-route/redb.Route/ErrorHandling/DeadLetterHeaders.cs
Snapshot: redb-route, development snapshot 2026-12-06. This is the development state of the public mirrors; it may differ from the published packages.
License: Apache-2.0. Repository: https://github.com/redbase-app/redb-route
Page: https://redbase.app/src/dev-2026-12-06/redb-route/redb.Route/ErrorHandling/DeadLetterHeaders.cs
----
using redb.Route.Abstractions;
namespace redb.Route.ErrorHandling;
///
/// The headers a dead-lettered exchange carries (Apache Camel's CamelDeadLetter* family): why, what, when and
/// after how many redeliveries. One place for every dead letter channel of the engine.
///
internal static class DeadLetterHeaders
{
/// Stamps with before it goes to a dead letter endpoint.
/// The failed exchange.
/// What failed it.
/// Redeliveries made before giving up; not written when zero.
internal static void Stamp(IExchange exchange, Exception failure, int redeliveries)
{
exchange.In.Headers["CamelDeadLetterReason"] = failure.Message;
exchange.In.Headers["CamelDeadLetterExceptionType"] = failure.GetType().FullName;
exchange.In.Headers["CamelDeadLetterTimestamp"] = DateTimeOffset.UtcNow;
if (redeliveries > 0)
exchange.In.Headers["CamelDeadLetterRedeliveryCount"] = redeliveries;
}
}