1

In the Symfony 2.7 application I'm developing I need to consume about RabbitMQ data. I install RabbitMQBundle and good, but when I try to consume I get the following error

 [PhpAmqpLib\Exception\AMQPProtocolChannelException]
 ACCESS_REFUSED - access to exchange 'options' in vhost '/' refused for user 'user'

config.yml:

 old_sound_rabbit_mq:
    connections:
      default:
        host:     'my-url'
        port:     5672
        user:     'user'
        password: 'pass'
        vhost:    '/'
        lazy:     false
        connection_timeout: 3
        read_write_timeout: 3

        # requires php-amqplib v2.4.1+ and PHP5.4+
        keepalive: false

        # requires php-amqplib v2.4.1+
        heartbeat: 0
  consumers:
    read_node:
        connection:       default
        exchange_options: { name: 'options', type: direct}
        queue_options:    { name: 'options' }
        callback:         process_node

services.yml:

 services:
     process_node:
        class: AppBundle\Consumer\RabbitConsumer

RabbitConsumer.php

  namespace AppBundle\Consumer;

 use OldSound\RabbitMqBundle\RabbitMq\ConsumerInterface;
 use PhpAmqpLib\Message\AMQPMessage;

 class RabbitConsumer implements ConsumerInterface{


    public function execute(AMQPMessage $msg) {
        return false;
    }

}

console command:

  php ./app/console rabbitmq:consumer read_node

I made a pure php script and working properly I hope someone can help me

1
  • You are getting the error "ACCESS_REFUSED - access to exchange 'options' in vhost '/' refused for user 'user'" so try to see what the user 'user' can't access the 'options' exchange on that vhost Commented Aug 10, 2015 at 15:06

1 Answer 1

1

You have to change the user and password to 'guest' and 'guest' respectvely, if you didnt change the default user settings of rabbitmq.

Otherwise you will need to create a new user in rabbitmq called 'user' and set the password to 'pass', for the code that you pasted above to work. But I suggest you change it to something sensible.

change user:

rabbitmqctl change_password tonyg newpass

add user:

add_user {username} {password}`

More info on the manual page of rabbitmq

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.