feat(sql/queue): merge DLQ logic into message table#34
Merged
Conversation
This was referenced Feb 20, 2026
behinddwalls
added a commit
that referenced
this pull request
Feb 20, 2026
## Summary ### Why? Need Publisher implementation to enable message publishing to SQL queue topics. ### What? - Publisher validates topic names and publishes single messages via MessageStore - Thread-safe with RWMutex for concurrent publish calls - Idempotent Close() operation - Comprehensive test coverage for publish, validation, metrics, and concurrency - Single and multiple message publishing tested - Invalid topic names rejected (uppercase, special chars, empty) - Publisher closed state prevents further publishes - Concurrent publish operations verified thread-safe - Context cancellation handled correctly ## Test Plan make test ## Issues ## Stack 1. @ #22 1. #23 1. #21 1. #24 1. #34
ff9f23e to
0e6c4cc
Compare
afee107 to
4cfb4c5
Compare
behinddwalls
added a commit
that referenced
this pull request
Feb 20, 2026
## Summary ## Why? Need to integrate publisher and subscriber with Queue factory interface and provide comprehensive documentation and end-to-end testing. ## What? - Factory creates publisher and subscriber singletons with lifecycle management - Comprehensive README with usage examples and architecture docs ## Test Plan ## Issues ## Stack 1. @ #24 1. #34 1. #35
sbalabanov
approved these changes
Feb 20, 2026
Why? Previously, DLQ messages were stored in a separate queue_dlq table, requiring separate schema management and limiting the ability to consume from DLQ topics. By merging DLQ into the messages table with a topic suffix pattern (e.g., "orders" → "orders_dlq"), we can: - Reuse existing subscriber/publisher logic for DLQ consumption - Simplify schema management (single table) - Track DLQ-specific metadata (failure_count, last_error, etc.) - Enable DLQ reprocessing workflows What? - Add TopicSuffix to DLQConfig (default "_dlq") - Add DLQ columns to queue_messages schema (failed_at, failure_count, last_error, original_topic) as nullable fields - Update MoveToDLQ to insert into queue_messages with DLQ topic name - Expose DLQ metadata through delivery metadata for testing - Remove separate queue_dlq.sql schema - Update FetchByOffset to select and populate DLQ fields - Fix unit test mocks to include all 11 columns - Document retry_count vs failure_count distinction in schema Co-Authored-By: Preetam Dwivedi <preetam@uber.com> refactor(queue/sql): use sentinel values instead of nullable DLQ fields Use 0 for int64/int and empty string for string fields instead of pointers. This simplifies the code and follows Go best practices. Changes: - messageRow: FailedAt, FailureCount, LastError, OriginalTopic now non-pointer - Schema: DLQ fields NOT NULL (no DEFAULT in schema, set in app code) - Insert: explicitly set DLQ fields to 0/"" for normal messages - FetchByOffset: scan into regular types (0/"" for normal messages) - Subscriber: check > 0 or != "" instead of != nil - Tests: mock with 0/"" instead of nil Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
4cfb4c5 to
fca4ddc
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Why?
Previously, DLQ messages were stored in a separate queue_dlq table,
requiring separate schema management and limiting the ability to
consume from DLQ topics. By merging DLQ into the messages table with
a topic suffix pattern (e.g., "orders" → "orders_dlq"), we can:
What?
last_error, original_topic) as nullable fields
Test Plan
Issues
Stack