feat: Dead-letter Queue#4
Draft
Chriztiaan wants to merge 1 commit 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.
Problem
When mutations are uploaded to the backend, non-transient/fatal errors in the flow can cause the upload pipeline to be stuck as it can't progress the uploaded queue. To avoid this, some of our demos call
transaction.complete()on fatal errors to let the upload queue progress but in turn causing the mutation to be thrown out.Solution
The PowerSync docs mention dead-letter queues as a mechanism for keeping these entries that would otherwise be lost. Fatal errors are caught on the server side and the mutation payload alongside debugging information is stored in a database allowing developers/admins to inspect the data and handle the entry however they need (replay, reshape, etc).
This PR introduces an example of how this could be implemented, alongside a hook that fires when a new dead-letter queue entry is added (typically users could use that to kick off a notification or even their reconciliation logic).
Outstanding
Diagram
AI disclosure
This PR was created with the help of Claude Code. Help constitutes assistance in research, planning, and rough outline of implementation. Beyond having a hand in the implementation, I have also manually tested this work.