Skip to content
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

AMQP 1.0 client: make it easier to pass in a virtual host #13661

Closed

Conversation

michaelklishin
Copy link
Member

while AMQP 1.0 does not have the concept of virtual hosts, RabbitMQ still does, and so do shovels
and other components.

Currently the way to pass a virtual host is via
a query parameter named 'hostname', which is
very counterintuitive to most users.

With this PR, there are now two better options:

  1. The URI path, with the leading slash stripped off
  2. The 'vhost' query parameter which is formatted correctly

Both still feed the 'hostname' connection parameter but are much easier to guess and remember
for, say, AMQP 1.0 Shovel users.

while AMQP 1.0 does not have the concept of virtual
hosts, RabbitMQ still does, and so do shovels
and other components.

Currently the way to pass a virtual host is via
a query parameter named 'hostname', which is
very counterintuitive to most users.

With this PR, there are now two better options:

1. The URI path, with the leading slash stripped off
2. The 'vhost' query parameter which is formatted
   correctly

Both still feed the 'hostname' connection parameter
but are much easier to guess and remember
for, say, AMQP 1.0 Shovel users.
@michaelklishin
Copy link
Member Author

I don't feel strongly about the URI path segment part, it can be rolled back. But asking the user to pass in a hostname via query parameters to pass in the virtual host is very counterintuitive.

* Add test case specifying vhost three different ways in the URI to see which one "wins".
Copy link
Collaborator

@lukebakken lukebakken left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍

Copy link
Contributor

@kjnilsson kjnilsson left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't think this is a good change. The client is a generic AMQP client not a RabbitMQ specific wrapper. There is no vhost parameter in the AMQP open frame.

@michaelklishin
Copy link
Member Author

@kjnilsson we do not have a different client to use for AMQP 1.0 shovels. With this change, nothing breaks for those who use this client with another AMQP 1.0 broker.

Our current "solution" for specifying a virtual host is incredibly confusing. At the very least we should support vhost in query strings instead of hostname set to vhost:{value}.

@michaelklishin michaelklishin deleted the mk-amqp10-client-simplify-passing-in-virtual-host branch April 1, 2025 14:40
@michaelklishin
Copy link
Member Author

The conclusion is: there are plans to change way we propagate this additional piece of information from the AMQP 1.0 Erlang client to the AMQP 1.0 implementation in RabbitMQ (the change won't affect other AMQP 1.0 brokers).

We'd still need a simplification of URI parsing, possibly in the Shovel plugin, but the hostname field is a part of the AMQP 1.0 documentation and some believe that AMQP 1.0 users must read it, or at least read an overview of sorts.

I'll update Shovel guides a bit to make extra clear what needs to be done at the moment, a hostname URI query parameter must be set to vhost:{name}.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants