You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Redis protocol does not define a specific way to pass additional data like header.
However, there is often need to pass them (for example for traces propagation).
This implementation injects optional header values marked with a signature into
payload body during publishing. When message is consumed, if signature is present,
header and original payload are extracted from augmented payload.
Header is defined as http.Header for better interoperability with existing libraries,
for example with propagation.HeaderCarrier.
// ....h:=make(http.Header)
h.Set("X-Baz", "quux")
// You can add header to your payload during publish._=pub.Publish(rmq.PayloadWithHeader(`{"foo":"bar"}`, h))
// ...._, _=con.AddConsumerFunc("tag", func(delivery rmq.Delivery) {
// And receive header back in consumer.delivery.(rmq.WithHeader).Header().Get("X-Baz") // "quux"// ....
})
This change is intended to be backwards compatible.
Header parsing is only done if payload starts with "\xFF\x00\xBE\xBEJ", such signature is added along with header values explicitly by caller during publishing (using PayloadWithHeader helper).
The reason will be displayed to describe this comment to others. Learn more.
This seems like a quite dangerous change as it changes how deliveries are stored in Redis. I think we should explicitly point this out in the PR description, in the Readme and in the release notes of this PR.
It's not a breaking change as it doesn't affect you if you only upgrade but don't start using the headers. But for clients who want to start using the headers I think we need to point out that the rollout needs to be properly planned.
The simplest would probably just be to suggest to update all consumers to run with the new version and be ready to consume deliveries with headers (while still also handling deliveries without headers), before then updating the producers to start producing deliveries with headers.
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
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.
Redis protocol does not define a specific way to pass additional data like header.
However, there is often need to pass them (for example for traces propagation).
This implementation injects optional header values marked with a signature into
payload body during publishing. When message is consumed, if signature is present,
header and original payload are extracted from augmented payload.
Header is defined as
http.Headerfor better interoperability with existing libraries,for example with
propagation.HeaderCarrier.This change is intended to be backwards compatible.
Header parsing is only done if payload starts with
"\xFF\x00\xBE\xBEJ", such signature is added along with header values explicitly by caller during publishing (usingPayloadWithHeaderhelper).