Documentation
¶
Overview ¶
Package dlq contains controllers that consume messages from per-topic dead-letter queues and reconcile the affected request and batch entities into a terminal failed state.
Background. The consumer framework moves a message to its DLQ after the controller for the original topic returns a non-retryable error or exhausts retries on a retryable error. Without DLQ reconciliation the affected request would remain stuck in a non-terminal state (e.g. Validated, Batched, Processing) forever — the gateway would still report it as "in progress" even though no pipeline stage is going to advance it.
Reconciliation strategy. Each DLQ topic carries the same payload as its originating topic (the queue framework preserves the bytes verbatim under a new `{topic}_dlq` name). The DLQ controllers decode that payload to recover the affected request or batch, then transition it to a terminal failed state — Error for requests, Failed for batches — with an idempotent optimistic-locking write so concurrent activity (a late merge, a cancel race) wins cleanly. Batch failures also fan out to the member requests so the gateway no longer reports them as in-progress.
Index ¶
- func DecodeCancelRequestID(payload []byte) (entity.RequestID, error)
- func DecodeLandRequestID(payload []byte) (entity.RequestID, error)
- func DecodeRequestID(payload []byte) (entity.RequestID, error)
- func NewDLQBatchController(logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, ...) consumer.Controller
- func NewDLQBuildSignalController(logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, ...) consumer.Controller
- func NewDLQLogController(logger *zap.SugaredLogger, scope tally.Scope, topicKey consumer.TopicKey, ...) consumer.Controller
- func NewDLQMergeConflictSignalController(logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, ...) consumer.Controller
- func NewDLQMergeSignalController(logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, ...) consumer.Controller
- func NewDLQRequestController(logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, ...) consumer.Controller
- func NewDLQSpeculateController(logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, ...) consumer.Controller
- func TopicKey(main consumer.TopicKey) consumer.TopicKey
- type RequestIDDecoder
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func DecodeCancelRequestID ¶
DecodeCancelRequestID extracts the request ID from a CancelRequest payload (the shape used by the cancel topic).
func DecodeLandRequestID ¶
DecodeLandRequestID extracts the request ID from a LandRequest payload (the shape used by the start topic).
func DecodeRequestID ¶
DecodeRequestID extracts the request ID from a RequestID payload (the shape used by the validate and batch topics).
func NewDLQBatchController ¶
func NewDLQBatchController( logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, registry consumer.TopicRegistry, topicKey consumer.TopicKey, consumerGroup string, ) consumer.Controller
NewDLQBatchController builds a DLQ controller for a batch-scoped topic. topicKey must be the DLQ topic key (typically TopicKey(primary)).
func NewDLQBuildSignalController ¶
func NewDLQBuildSignalController( logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, registry consumer.TopicRegistry, topicKey consumer.TopicKey, consumerGroup string, ) consumer.Controller
NewDLQBuildSignalController builds a DLQ controller for the buildsignal topic.
func NewDLQLogController ¶
func NewDLQLogController( logger *zap.SugaredLogger, scope tally.Scope, topicKey consumer.TopicKey, consumerGroup string, ) consumer.Controller
NewDLQLogController builds a DLQ controller for the log topic.
func NewDLQMergeConflictSignalController ¶
func NewDLQMergeConflictSignalController( logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, registry consumer.TopicRegistry, topicKey consumer.TopicKey, consumerGroup string, ) consumer.Controller
NewDLQMergeConflictSignalController builds a DLQ controller for the mergeconflictsignal topic.
func NewDLQMergeSignalController ¶
func NewDLQMergeSignalController( logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, registry consumer.TopicRegistry, topicKey consumer.TopicKey, consumerGroup string, ) consumer.Controller
NewDLQMergeSignalController builds a DLQ controller for the mergesignal topic.
func NewDLQRequestController ¶
func NewDLQRequestController( logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, registry consumer.TopicRegistry, decode RequestIDDecoder, topicKey consumer.TopicKey, consumerGroup string, ) consumer.Controller
NewDLQRequestController builds a DLQ controller for a request-scoped topic. topicKey must be the DLQ topic key (typically TopicKey(primary)); decode must match the payload shape of the primary topic this DLQ drains.
func NewDLQSpeculateController ¶
func NewDLQSpeculateController( logger *zap.SugaredLogger, scope tally.Scope, stores storage.Factory, registry consumer.TopicRegistry, topicKey consumer.TopicKey, consumerGroup string, ) consumer.Controller
NewDLQSpeculateController builds the DLQ controller for the speculate topic. topicKey must be the DLQ topic key (typically TopicKey(primary)).
func TopicKey ¶
TopicKey returns the DLQ topic key for the given primary pipeline topic. The returned key is meant to be used both when registering the DLQ topic with the topic registry and when the corresponding DLQ controller advertises its TopicKey(). It is exported so the orchestrator wiring layer can build matching pairs without duplicating the suffix literal.
Types ¶
type RequestIDDecoder ¶
RequestIDDecoder extracts the affected request's identity — its ID and its queue — from the raw payload bytes of a DLQ message. Different primary topics carry different payload shapes (LandRequest on start, CancelRequest on cancel, RequestID on validate / batch), so the caller injects the right decoder for the topic being reconciled. Returning an empty ID is treated as a decode failure.