feat(dlr): replace MVStore with PostgreSQL persistence - #309
Draft
lykakis wants to merge 20 commits into
Draft
Conversation
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.
What
This PR replaces Sendium's MVStore-based DLR persistence with a fail-closed PostgreSQL lifecycle for provider correlation and downstream receipt delivery.
It introduces:
sendium_dlr.dlr_messagerow per gateway message for ingress metadata, terminal provider outcome, downstream HTTP/SMPP payload, delivery status, retry schedule, and fenced attempt number.(provider_name, provider_message_id)pair.ACCEPTDandENROUTEreceipts are acknowledged without consuming correlation, while the first terminal receipt consumes every correlation for the gateway message.deliver_sm_respsucceeds and replays pending rows when the samesystem_idbinds again.The broader persistence replacement also:
msg.hash.prefixwhile allowing different providers to reuse the same message ID independently.STATUS_SYSERRwhen a provider-originated terminal receipt cannot be resolved durably.sendium-coreand enables it explicitly insendium-app.StandardMessageTrackerandStandardSmppServerMessageStore;InMemoryQueueProviderremains because router and worker queues are still process-local.Downstream delivery metrics and a new structured DLR event schema are intentionally deferred to a separate observability design and PR. This PR retains the existing PostgreSQL storage metrics and existing
message.deliver.*events.Why
Sendium must retain DLR state long enough to correlate provider receipts with the original gateway message and complete downstream HTTP or SMPP delivery after process restarts and transient failures.
The previous local persistence model tied state to one application filesystem and could fall back to volatile storage. It also removed resolved state before downstream delivery was acknowledged, leaving a crash window where a provider receipt could be accepted and then lost before reaching the originating client.
PostgreSQL provides an externally managed durability boundary with transactional transitions, versioned migrations, standard backup and monitoring options, and consistent behavior across application restarts.
Final Lifecycle
submit_sm_respID to the exact provider namespace and gateway message.deliver_sm_respPDUs for every SMPP receipt part.The reusable
sendium-coremodule does not activate this infrastructure automatically. Applications that own or do not use Sendium's DLR persistence lifecycle can embed the core without requiring a DLR database, while the standalone application retains a coherent fail-closed PostgreSQL contract.Important Boundaries
FAILEDand remains until retention cleanup.msg.hash.prefixor renaming a worker using the default namespace makes earlier receipts unresolvable.Verification
mvnw -pl sendium-core verifygit diff --checkpass.Review Map
The branch is organized into reviewable stages. Compatibility wiring introduced in earlier stages is removed by finalization stages; the final PR state is PostgreSQL-only.
8c85e0fthroughe3685b3c71c45bthrough93aeb461965fe6through062a308ba2c582through91d1f5481f58afthrough92a75ccc18ab9ethrough24f08adSuggested Review Areas
STATUS_SYSERRretry behavior.sendium-core.