Search code examples
rabbitmqrabbitmq-exchange

Configuring 'amq.rabbitmq.event' exchange to a different vhost?


I am configuring RabbitMQ with the rabbitmq_event_exchange plugin. I am using this plugin to listen to RabbitMQ events. By default, the plugin is creating an exchange named 'amq.rabbitmq.event' in the default vhost(/) . But, I am trying to change vhost to 'test' (custom vhost created by me) As per the instructions from the plugin page, I added a property rabbitmq_event_exchange.vhost= test in my rabbitmq.conf file. But I am getting an exception when I try to run the RabbitMQ

    Config file generation failed 10:50:18.141 [error] You've tried to 
    set rabbitmq_event_exchange.vhost, but there is no setting with 
    that name.
    10:50:18.141 [error]   Did you mean one of these?
    10:50:18.176 [error]     mqtt.exchange
    10:50:18.176 [error]     log.exchange.level
    10:50:18.176 [error]     management.listener.port
    10:50:18.176 [error] Error generating configuration in phase 
    transform_datatypes
    10:50:18.176 [error] Conf file attempted to set unknown variable: 
    rabbitmq_event_exchange.vhost

My rabbitmq.conf file

    management.load_definitions= /opt/definitions.json
    #MQTT config
    mqtt.default_user= guest
    mqtt.default_pass= guest
    mqtt.allow_anonymous= false
    mqtt.exchange= MQTT
    mqtt.vhost= test

    #RabbitMQ event exchange config
    rabbitmq_event_exchange.vhost= test

Solution

  • The plugin doesn't provide a new style configuration schema yet. I have raised an issue in the plugin GitHub page to make this enhancement. We have to use the advanced.config file and the classic config format to configure the custom vhost.

    advanced.config

    [
      {rabbitmq_event_exchange, [{vhost, <<"test">>}]}
    ].
    

    Ref: https://groups.google.com/forum/#!topic/rabbitmq-users/Z7_5WGc2ubE