feat: add encoding_strategy option (wrapped / hybrid / flat)#73
Open
pulzarraider wants to merge 1 commit into
Open
feat: add encoding_strategy option (wrapped / hybrid / flat)#73pulzarraider wants to merge 1 commit into
encoding_strategy option (wrapped / hybrid / flat)#73pulzarraider wants to merge 1 commit into
Conversation
Introduces an opt-in encoding format for Pub/Sub messages that exposes serializer headers as native Pub/Sub attributes instead of nesting them inside a JSON wrapper.
- `wrapped` (default, deprecated): legacy `{body, headers}` JSON in the message data; will be removed in 5.0.
- `flat`: serializer body is published as `data`, serializer headers as attributes. Recommended for new projects.
- `hybrid`: senders publish flat, receivers decode both formats. Use on receivers during migration.
Per-message format detection in `hybrid` mode uses a reserved Pub/Sub attribute (`ppgps-encoding-version`) set by flat/hybrid senders; messages without it (older bundle versions, including ones already in the topic at upgrade time) fall back to wrapped decoding. The reserved attribute key cannot be overridden via `AttributesStamp` — the sender appends it last.
In flat/hybrid mode an `AttributesStamp` is merged with the serializer headers (stamp wins on collision), preventing the stamp from silently dropping serializer headers.
This was referenced May 9, 2026
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.
Introduces an opt-in encoding format for Pub/Sub messages that exposes serializer headers as native Pub/Sub attributes instead of nesting them inside a JSON wrapper.
wrapped(default, deprecated): legacy{body, headers}JSON in the message data; will be removed in 5.0.flat: serializer body is published asdata, serializer headers as attributes. Recommended for new projects.hybrid: senders publish flat, receivers decode both formats. Use on receivers during migration.Per-message format detection in
hybridmode uses a reserved Pub/Sub attribute (ppgps-encoding-version) set by flat/hybrid senders; messages without it (older bundle versions, including ones already in the topic at upgrade time) fall back to wrapped decoding. The reserved attribute key cannot be overridden viaAttributesStamp— the sender appends it last.In flat/hybrid mode an
AttributesStampis merged with the serializer headers (stamp wins on collision), preventing the stamp from silently dropping serializer headers.