我使用rabbitmq作为amqp服务器(集群)和kombu + py-amqp作为amqp客户端。我可以发送/接收普通消息队列的消息,但我不知道如何发送/接收镜像队列的消息,我找不到谷歌的答案。如何发送/接收镜像队列消息?
我的代码:
with Connection(hostname='192.168.1.10',userid='test',password='test',virtual_host='test') as conn:
simple_queue = conn.SimpleQueue('test')
并获得异常
File "./test_amqp.py", line 38, in send
simple_queue = conn.SimpleQueue('test')
File "/usr/local/lib/python3.2/site-packages/kombu/connection.py", line 671, in SimpleQueue
exchange_opts, **kwargs)
File "/usr/local/lib/python3.2/site-packages/kombu/simple.py", line 122, in __init__
consumer = messaging.Consumer(channel, queue)
File "/usr/local/lib/python3.2/site-packages/kombu/messaging.py", line 338, in __init__
self.revive(self.channel)
File "/usr/local/lib/python3.2/site-packages/kombu/messaging.py", line 350, in revive
self.declare()
File "/usr/local/lib/python3.2/site-packages/kombu/messaging.py", line 360, in declare
queue.declare()
File "/usr/local/lib/python3.2/site-packages/kombu/entity.py", line 471, in declare
self.queue_declare(nowait, passive=False)
File "/usr/local/lib/python3.2/site-packages/kombu/entity.py", line 497, in queue_declare
nowait=nowait)
File "/usr/local/lib/python3.2/site-packages/amqp/channel.py", line 1240, in queue_declare
(50, 11), # Channel.queue_declare_ok
File "/usr/local/lib/python3.2/site-packages/amqp/abstract_channel.py", line 70, in wait
return self.dispatch_method(method_sig, args, content)
File "/usr/local/lib/python3.2/site-packages/amqp/abstract_channel.py", line 88, in dispatch_method
return amqp_method(self, args)
File "/usr/local/lib/python3.2/site-packages/amqp/channel.py", line 222, in _close
(class_id, method_id), ChannelError)
amqp.exceptions.PreconditionFailed: Queue.declare: (406) PRECONDITION_FAILED - inequivalent arg 'x-ha-policy'for queue 'smarton' in vhost 'smarton': received none but current is the value 'all' of type 'longstr'