ricbra / rabbitmq-cli-consumer

Consume RabbitMQ messages into any cli program
MIT License
247 stars 49 forks source link

When using vhost getting 403 #55

Open amorimdev opened 7 years ago

amorimdev commented 7 years ago

Any vhost that I put in the configuration file other than "/", sample "/test", throws forbidden error: 2017/07/12 16:13:56 Connecting RabbitMQ... 2017/07/12 16:13:56 Failed creating consumer: Failed connecting RabbitMQ: Exception (403) Reason: "no access to this vhost"

ricbra commented 7 years ago

Seems like a configuration issue. Did you create a vhost and user? Is the consumer configured correctly?

amorimdev commented 7 years ago

Yes, i create vhost and user, works perfectly in symfony posting messages. The configuration is the same as I'm using in my parameters.yml for RabbitMqBundle. I released the user access to "/", when I change the setting to vhost "/" it works, but if put vhost for sample "/test-or-any" its not works

ozzmaster commented 7 years ago

My solution was to add an extra / to the start of the vhost in the conf file:

[rabbitmq] host = localhost username = guest password = **** vhost=//host_name port=5672 queue=queue_name compression=Off

mz-jy commented 5 years ago

I had the similar issue; however, it turned out that for the name of the vhost, I need to add an addition / to connect it. For example, if i created a vhost '/test', I need to connect to amqp://guest:guest@localhost:5672//test for this to work. So, in my point of view, the string /test is seen integratedly as the name of the vhost, and what happened to me was just the misuse of the name of the vhost.