-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
When not wrapping fallback to base64 encoding in case invalid SQS chars are being used #2646
Merged
Conversation
This file contains 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
danielmarbach
requested review from
lailabougria,
andreasohlund and
mauroservienti
November 28, 2024 11:19
danielmarbach
force-pushed
the
do-not-wrap-invalid-chars
branch
from
November 28, 2024 11:25
66e7517
to
1585fb4
Compare
…rs are being used (most straightforward impl ignoring perf)
danielmarbach
force-pushed
the
do-not-wrap-invalid-chars
branch
from
November 28, 2024 11:30
1585fb4
to
3aad938
Compare
andreasohlund
approved these changes
Nov 28, 2024
...port.SQS.TransportTests.DoNotWrapOutgoingMessages/Sending_messages_with_invalid_sqs_chars.cs
Outdated
Show resolved
Hide resolved
...iceBus.Transport.SQS.AcceptanceTests/Sending/When_sending_messages_with_invalid_sqs_chars.cs
Outdated
Show resolved
Hide resolved
lailabougria
approved these changes
Nov 29, 2024
This was referenced Dec 2, 2024
Closed
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.
This is a follow-up on:
Which also addresses:
Originally,
DoNotWrapOutoingMessages
was designed to no longer base64 encode and wrap the message with the transport message. The idea was to purely hand over whatever we got to the transport. So in cases of raw dispatches when the message contains characters that are not compliant with the SQS message encoding constraints, the transport would throw.This has consequences for scenarios like sending metrics when the payload uses raw bytes that may be incompatible with the text restrictions of SQS. By discovering that an encoded payload has characters that are not suitable to be sent and then falling back to base64 encoding, those scenarios are handled.
The transport pump already assumes when it receives non-native messages that the body might be base4 encoded and therefore gracefully falls back to reading those encoded special cases too without any extra code required.
The consequence of the change is that when not wrapping, the payload needs to be inspected for illegal characters which has computational overhead. The current implementation uses the most straightforward approach using a source-gened regex that should be reasonably fast enough. Future optimizations could be done by checking the byte array directly for invalid byte sequences / code points.