Dead letter abstraction.
A dead letter sink is responsible for capturing failed message processing so the message can be inspected/replayed later.
envelope: the original message envelope consumed by a handler.
Conventionally includes :metadata (e.g. {:trace ...}) plus a message payload.error-info: map describing the failure. At minimum:
:error: exception, string, keyword, or any useful error value:stacktrace: stacktrace string (optional)opts: runtime options that can tweak delivery behavior:
:sink: overrides the chosen sink when using the common facade:dlq-topic: override destination topic (producer sink):max-retries: override max retries (producer sink):delay-ms: override delay before publishing (producer sink)A result map that MUST include :ok boolean and SHOULD include :sink keyword.
Implementations may add details like :path, :topic, :retry-count, etc.
Dead letter abstraction.
A dead letter sink is responsible for capturing *failed* message processing so the
message can be inspected/replayed later.
## Inputs
- `envelope`: the original message envelope consumed by a handler.
Conventionally includes `:metadata` (e.g. `{:trace ...}`) plus a message payload.
- `error-info`: map describing the failure. At minimum:
- `:error`: exception, string, keyword, or any useful error value
- `:stacktrace`: stacktrace string (optional)
- `opts`: runtime options that can tweak delivery behavior:
- `:sink`: overrides the chosen sink when using the common facade
- `:dlq-topic`: override destination topic (producer sink)
- `:max-retries`: override max retries (producer sink)
- `:delay-ms`: override delay before publishing (producer sink)
- plus any backend-specific options (e.g. storage put opts)
## Return
A result map that MUST include `:ok` boolean and SHOULD include `:sink` keyword.
Implementations may add details like `:path`, `:topic`, `:retry-count`, etc.(send-dead-letter! this envelope error-info opts)Send a failed message to the configured dead letter sink.
Send a failed message to the configured dead letter sink.
(normalize-error-info error-info)Normalizes error-info to be safe for logging/encoding.
Expected input shape:
{:error <Exception|string|keyword|any> :stacktrace <string|nil> ...}Normalization rules:
:error is an Exception, it becomes a map with :message/:class.:stacktrace is non-string, it is coerced via str.Returns a map.
Normalizes `error-info` to be safe for logging/encoding.
Expected input shape:
- `{:error <Exception|string|keyword|any> :stacktrace <string|nil> ...}`
Normalization rules:
- If `:error` is an Exception, it becomes a map with `:message`/`:class`.
- If `:stacktrace` is non-string, it is coerced via `str`.
- Unknown keys are preserved.
Returns a map.cljdoc builds & hosts documentation for Clojure/Script libraries
| Ctrl+k | Jump to recent docs |
| ← | Move to previous article |
| → | Move to next article |
| Ctrl+/ | Jump to the search field |