feat: add source/cdc change-event codec#133
Merged
Merged
Conversation
Decode the Debezium/OpenCDC JSON change-event envelope into a typed ChangeEvent (Operation enum, deferred before/after row images, decoded source metadata, commit timestamp) with BeforeAs/AfterAs projection and SourceHeaders. Tombstones decode to OpTombstone; malformed envelopes return *DecodeError (poison). Ships as a stdlib subpackage of the source module alongside retry/dlq, with a memsource consume test and a CDC-driven Drive example in source/statemachine. Native WAL connectors stay future work. Signed-off-by: Joshua Temple <[email protected]>
1985641 to
6aa78e9
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.
What this change does
Adds
source/cdc, a change-data-capture codec for thesourceseam (one of the four roadmap items from #131). It decodes the Debezium / OpenCDC JSON change-event envelope into a typedChangeEvent:Operationenum (create/update/delete/read/tombstone),BeforeAs/AfterAs,SourceHeaders) and the commit timestamp.Tombstones decode to
OpTombstone; malformed envelopes return a*DecodeErrorso they route as poison rather than crashing the consume loop.Why
CDC turns a database into an event source, and the envelope is effectively a standard, so decoding it belongs in the suite rather than in every consumer. It ships as a stdlib-only subpackage of the
sourcemodule alongsideretry/dlq(no new dependency), with amemsourceconsume test and a CDC-drivenDriveexample insource/statemachineshowing a change event driving a statechart. Native WAL connectors stay future work; this is the decode layer they'd feed.Relates to: follows up the source Tier-1 PR (#131).
Checklist
git commit -s) per the DCOtype: subject)mage checkruns in CI across the workspace