Expand description
Dead-letter sink for unroutable or unprocessable inbound messages.
BDEW AS4 requires that every received message is either processed or explicitly refused (CONTRL negative acknowledgement). Messages that cannot be routed to a workflow — because the PID is unknown, the conversation is not in-flight, or the format version has no adapter — must not be silently dropped.
§Design
DeadLetterSink is a synchronous trait that receives a structured
DeadLetterReason for every rejected message. The synchronous contract
keeps dispatch-path hot code fast; implementations that need async work
(e.g. persisting to a durable DLQ or sending a CONTRL) can use
tokio::spawn internally.
§Implementations
| Type | Behaviour |
|---|---|
LogDeadLetterSink | Emits structured tracing::warn!; suitable for all deployments |
NoopDeadLetterSink | Silently discards; only for testing |
§Wiring
Pass an implementation to EngineBuilder::with_dead_letter_sink.
The default is LogDeadLetterSink so unroutable messages are always
visible in the log output without any configuration.
use mako_engine::dead_letter::{AuditContext, DeadLetterReason, DeadLetterSink, LogDeadLetterSink};
let sink = LogDeadLetterSink;
sink.reject(&DeadLetterReason::UnknownPid { pid: 99999, context: AuditContext::now() });Structs§
- Audit
Context - Structured audit context attached to every dead-letter event.
- LogDead
Letter Sink - A
DeadLetterSinkthat emits a structuredtracing::warn!event for every rejected message. - Noop
Dead Letter Sink - A
DeadLetterSinkthat silently discards all rejected messages.
Enums§
- Dead
Letter Reason - Structured reason why an inbound message was rejected.
Traits§
- Dead
Letter Sink - Receives messages that cannot be routed or processed.