我正在尝试使用声明列表为 RabbitMQ 配置 Shovel 插件。创建远程交换时,我已将远程交换配置为具有备用交换。
我的问题是我无法让 shovel 的配置文件包含此参数,因此 RabbitMQ 在启动时崩溃。
这是我的配置的样子:
[
{mnesia, [{dump_log_write_threshold, 100}]},
{rabbit, [{vm_memory_high_watermark, 0.4}]},
{rabbitmq_shovel,
[{shovels,
[{call_stats_shovel,
[{sources, [{broker, "amqp://guest:guest@localhost: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:guest@172.16.3.162: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}
]}
]
}]
}
].
问题出在名为 my-exchange-topic 的目标交换上。如果我取出声明部分,那么配置文件将起作用。
这是错误:
=INFO REPORT==== 2012 年 7 月 31 日::12:15:25 === 应用程序:rabbitmq_shovel 退出:{{invalid_shovel_configuration,call_stats_shovel, {invalid_parameter_value,destinations, {unknown_fields,'exchange.declare', [alternate_exchange] }}}, {rabbit_shovel,start,[normal,[]]}} 类型:永久
如果我将alternate_exchange 部分排除在声明之外,我会在RabbitMQ Web 管理中收到此错误:
{{shutdown, {server_initiated_close,406, <<"PRECONDITION_FAILED - 不等价的 arg 'alternate-exchange' 用于 vhost 'blah' 中的交换 'my-exchange-topic':没有收到,但当前是 'longstr' 类型的值 'alt' '">>}}, {gen_server,call, [<0.473.0>, {call, {'exchange.declare',0,<<"my-exchange-topic">>,<<"topic">> ,假,真,假,假,假,[]},无,<0.444.0>},无穷大]}}