@DeadLetterQueue annotation enables automatic routing of failed events to a dedicated MongoDB collection. When a handler throws an exception — and all retries are exhausted if @RetryPolicy is present — the event is persisted in the DLQ instead of being silently lost.
Attributes
| Attribute | Type | Default | Description |
|---|---|---|---|
enabled | boolean | true | Whether DLQ is enabled |
collection | String | "_fw_dlq" | MongoDB collection name for the DLQ |
ttlDays | int | 30 | Time-to-live in days. 0 means permanent (no expiry) |
includeOriginalDocument | boolean | true | Whether to include the original document in the DLQ entry |
includeStackTrace | boolean | true | Whether to include the full stack trace in the DLQ entry |
collection
The MongoDB collection where failed events are stored. All streams sharing the same collection value write to the same DLQ collection — events are distinguished by their streamName field.
ttlDays
Controls automatic cleanup of DLQ entries via MongoDB’s TTL mechanism. Set to 0 to keep entries permanently.
includeOriginalDocument and includeStackTrace
These control what data is captured in the DLQ entry. Disabling them can reduce storage for high-throughput streams where you only need the error metadata.
DLQ Storage SPI
TheDlqStore interface is the SPI that backs @DeadLetterQueue. The MongoDB implementation is auto-configured, but you can provide your own by registering a DlqStore bean.
FailedEvent record
FailedEvent record
Roadmap
The following attributes are planned but not yet implemented:| Attribute | Description | Status |
|---|---|---|
reprocessStrategy | Automatic reprocessing strategy (MANUAL, AUTO_CRON) | Planned |
reprocessCron | Cron expression for automatic reprocessing | Planned |
reprocessBatchSize | Batch size for automatic reprocessing | Planned |
mongoTemplateRef | Custom MongoTemplate bean reference for multi-datasource setups | Planned |
See Also
Retry & DLQ Guide
Understand DLQ routing, manual sends, document schema, and best practices
@RetryPolicy
Configure exponential backoff retry for failed handlers
@Checkpoint
Resume token persistence for reliable stream recovery
ChangeStreamContext
Runtime context including sendToDlq(), attempt number, and more

