AMQP url and virtual host (vhost), best practice (to slash or not)

1,430 views
Skip to first unread message

Tippa Virtanen

unread,
Dec 4, 2016, 11:23:46 AM12/4/16
to rabbitmq-users
Hi coders!

when/if I specify virtual host (vhost), which way is preferable (best practice)
1) to use leading slash, for example "/foobar"
... and address amqp://localhost:5672/%2Ffoobar
or
2) not to use slash, for example "foobar"
... and address amqp://localhost:5672/foobar

And
3) Why either way is better?
4) Do these two ways have any other facts nice to know? Side effects?

many thanks in advance.

Rgds T.

Michael Klishin

unread,
Dec 4, 2016, 11:29:41 AM12/4/16
to rabbitm...@googlegroups.com
There is no good practice. Vhosts are not required to contain or begin with a slash. Since slash encoding is annoying and overlooked by some,
it is a bit easier to use vhosts without slashes.
Environment names can be concatenated using an underscore, e.g. my_project_development and my_project_production.
--
You received this message because you are subscribed to the Google Groups "rabbitmq-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to rabbitmq-user...@googlegroups.com.
To post to this group, send email to rabbitm...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

V Z

unread,
Dec 7, 2016, 3:34:48 PM12/7/16
to rabbitmq-users
I would not even think of prefixing the vhost with a slash. First, what value does it have or what message would it convey? Second, you need to worry about encoding it in the url. My best practice is to not use it.
Reply all
Reply to author
Forward
0 new messages