-
Notifications
You must be signed in to change notification settings - Fork 3.9k
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
Use different AMQP address format for v1 and v2 #11604
Merged
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
ansd
force-pushed
the
amqp-addr
branch
2 times, most recently
from
July 3, 2024 14:32
13f7a95
to
360f68e
Compare
to distinguish between v1 and v2 address formats. Previously, v1 and v2 address formats overlapped and behaved differently for example for: ``` /queue/:queue /exchange/:exchange ``` This PR changes the v2 format to: ``` /e/:exchange/:routing-key /e/:exchange /q/:queue ``` to distinguish between v1 and v2 addresses. This allows to call `rabbit_deprecated_features:is_permitted(amqp_address_v1)` only if we know that the user requests address format v1. Note that `rabbit_deprecated_features:is_permitted/1` should only be called when the old feature is actually used. Use percent encoding / decoding for address URI format v2. This allows to use any UTF-8 encoded characters including slashes (`/`) in routing keys, exchange names, and queue names and is more future safe.
Partially copy file https://github.com/ninenines/cowlib/blob/optimise-urldecode/src/cow_uri.erl We use this copy because: 1. uri_string:unquote/1 is lax: It doesn't validate that characters that are required to be percent encoded are indeed percent encoded. In RabbitMQ, we want to enforce that proper percent encoding is done by AMQP clients. 2. uri_string:unquote/1 and cow_uri:urldecode/1 in cowlib v2.13.0 are both slow because they allocate a new binary for the common case where no character was percent encoded. When a new cowlib version is released, we should make app rabbit depend on app cowlib calling cow_uri:urldecode/1 and delete this file (rabbit_uri.erl).
lhoguin
approved these changes
Jul 3, 2024
acogoluegnes
added a commit
to rabbitmq/rabbitmq-amqp-java-client
that referenced
this pull request
Jul 4, 2024
github-actions bot
pushed a commit
to rabbitmq/rabbitmq-amqp-java-client
that referenced
this pull request
Jul 4, 2024
ansd
added a commit
that referenced
this pull request
Jul 4, 2024
This commit is a follow up of #11604 This commit changes the AMQP address format v2 from ``` /e/:exchange/:routing-key /e/:exchange /q/:queue ``` to ``` /exchanges/:exchange/:routing-key /exchanges/:exchange /queues/:queue ``` Advantages: 1. more user friendly 2. matches nicely with the plural forms of HTTP API v1 and HTTP API v2 This plural form is still non-overlapping with AMQP address format v1. Although it might feel unusual at first to send a message to `/queues/q1`, if you think about `queues` just being a namespace or entity type, this address format makes sense.
ansd
added a commit
that referenced
this pull request
Jul 4, 2024
This commit is a follow up of #11604 This commit changes the AMQP address format v2 from ``` /e/:exchange/:routing-key /e/:exchange /q/:queue ``` to ``` /exchanges/:exchange/:routing-key /exchanges/:exchange /queues/:queue ``` Advantages: 1. more user friendly 2. matches nicely with the plural forms of HTTP API v1 and HTTP API v2 This plural form is still non-overlapping with AMQP address format v1. Although it might feel unusual at first to send a message to `/queues/q1`, if you think about `queues` just being a namespace or entity type, this address format makes sense.
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 PR is a refinement of #10873.
Use different AMQP address format for v1 and v2 to distinguish between v1 and v2 address formats.
Previously, v1 and v2 address formats overlapped and behaved differently for example for:
This PR changes the v2 format to:
to distinguish between v1 and v2 addresses.
This allows to call
rabbit_deprecated_features:is_permitted(amqp_address_v1)
only if we know that the user requests address format v1.
Note that
rabbit_deprecated_features:is_permitted/1
should onlybe called when the old feature is actually used.
Use percent encoding / decoding for address URI format v2.
This allows to use any UTF-8 encoded characters including slashes (
/
)in routing keys, exchange names, and queue names and is more future
safe.
Although less user friendly, the new address format is kept short to:
to
field must be stored unaltered)The alternative would have been something like:
or to set some capabilities or properties when attaching a link denoting that address format v2 is used.
Neither of these alternatives is really more user friendly compared to the short version.
Docs PR updating https://www.rabbitmq.com/docs/next/amqp#address will follow soon.