2012-07-31 42 views
1

我正在試圖爲RabbitMQ配置一個Shovel插件,並帶有一個聲明列表。我在創建遠程交換機時配置了備用交換機。RabbitMQ鏟交替配置

我的問題是,我無法獲得鏟的配置文件,以包含此參數,以便RabbitMQ在啓動時崩潰。

這是我的配置是什麼樣子:

[ 
    {mnesia, [{dump_log_write_threshold, 100}]}, 
    {rabbit, [{vm_memory_high_watermark, 0.4}]}, 
    {rabbitmq_shovel, 
     [{shovels, 
      [{call_stats_shovel, 
       [{sources, [{broker, "amqp://guest:[email protected]:5672/test"}, 
        {declarations, 
         [{'queue.declare', [{queue, <<"incoming">>}, durable]}, 
         {'exchange.declare',[{exchange, <<"my-exchange-topic">>},{type, <<"topic">>},durable]}, 
         {'queue.bind',[{exchange, <<"my-exchange-topic">>},{queue, <<"incoming">>}]} 
       ]}]}, 
       {destinations, [{broker, "amqp://guest:[email protected]:5672/blah"}, 
        {declarations, 
        [ 
         {'queue.declare',[{queue, <<"billing">>},durable]}, 
         {'exchange.declare',[{exchange, <<"my-exchange-topic">>},{type, <<"topic">>},{alternate_exchange, <<"alt">>}, durable]}, 
         {'queue.bind',[{exchange, <<"my-exchange-topic">>},{queue, <<"billing">>},{routing_key, <<"physical">>}]} 
        ]} 
       ]}, 
       {queue, <<"incoming">>}, 
       {ack_mode, no_ack}, 
       {publish_properties, [{delivery_mode, 2}]}, 
       {reconnect_delay, 5} 
       ]} 
      ] 
     }] 
    } 
]. 

的問題是目的地交換叫我交換話題。如果我拿出聲明部分,那麼配置文件就可以工作。

這是錯誤:

= INFO REPORT ==== 31-JUL-2012 :: 12:15:25 === 應用:rabbitmq_shovel 退出:{{invalid_shovel_configuration,call_stats_shovel, { invalid_parameter_value,目的地, {unknown_fields, 'exchange.declare', [alternate_exchange]}}},{ rabbit_shovel,啓動,[正常,[]]}} 類型:永久

如果我離開alternate_exchange節在聲明中,我在Rabb中得到這個錯誤itMQ網絡管理:

{{shutdown, {server_initiated_close,406, <<"PRECONDITION_FAILED - inequivalent arg 'alternate-exchange'for exchange 'my-exchange-topic' in vhost 'blah': received none but current is the value 'alt' of type 'longstr'">>}}, {gen_server,call, [<0.473.0>, {call, {'exchange.declare',0,<<"my-exchange-topic">>,<<"topic">>,false, true,false,false,false,[]}, none,<0.444.0>}, infinity]}}

回答

1

對於任何人在尋找如何配置的交流,並且需要額外的參數隊列你做這樣的:

{'exchange.declare',[{exchange, <<"my-exchange-topic">>},{type, <<"topic">>}, durable, {arguments, [{<<"alternate-exchange">>, longstr, <<"alternate-exchange">>}]} ]}, 

你可以做類似的事情與隊列:

{'queue.declare',[{queue, <<"my-queue">>},durable, {arguments, [{<<"x-dead-letter-exchange">>, longstr, <<"dead-letter-queue">>}]}]} 
0

對於上面的評論的說明,在exchange2exchange鏟的情況下,配置將是:

{'exchange.declare',[{exchange, <<"my-exchange-topic">>},{type, <<"topic">>}, durable, {arguments, [{<<"alternate-exchange">>, longstr, <<"name-of-your-alternate-exchange">>}]} ]},