2011-04-26 172 views
0

從Python解釋器中複製並粘貼,但我試圖與Kombu一起玩,但似乎無法創建消費者。請幫助,我完全在這裏黑暗中。需要此Kombu錯誤的幫助

>>> from kombu.messaging import Consumer, Producer 
>>> from kombu.entity import Exchange, Queue 
>>> x = Exchange("stmt",type="topic") 
>>> helloQ = Queue("hello", exchange=x, routing_key="stmt.hello") 
>>> 
>>> from kombu.connection import BrokerConnection 
>>> conn = BrokerConnection("scheduledb.lab.compete.com", "clippy", "clippy", "clippy") 
>>> channel = conn.channel() 
>>> c = Consumer(channel, helloQ) 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/messaging.py", line 231, in __init__ 
self.declare() 
File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/messaging.py", line 241, in declare 
    queue.declare() 
File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/entity.py", line 362, in declare 
    self.name and self.queue_declare(nowait, passive=False), 
File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/entity.py", line 380, in queue_declare 
    nowait=nowait) 
    File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/syn.py", line 14, in blocking 
    return __sync_current(fun, *args, **kwargs) 
    File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/syn.py", line 30, in __blocking__ 
    return fun(*args, **kwargs) 
File "build/bdist.cygwin-1.7.8-i686/egg/amqplib/client_0_8/channel.py", line 1294, in queue_declare 
File "build/bdist.cygwin-1.7.8-i686/egg/amqplib/client_0_8/abstract_channel.py", line 89, in wait 
File "build/bdist.cygwin-1.7.8-i686/egg/amqplib/client_0_8/connection.py", line 218, in _wait_method 
File "build/bdist.cygwin-1.7.8-i686/egg/amqplib/client_0_8/abstract_channel.py", line 105, in wait 
File "build/bdist.cygwin-1.7.8-i686/egg/amqplib/client_0_8/connection.py", line 367, in _close 
amqplib.client_0_8.exceptions.AMQPConnectionException: (530, u"NOT_ALLOWED - parameters for queue 'hello' in vhost 'clippy' not equivalent", (50, 10), 'Channel.queue_declare') 
>>> boundX = x(helloQ) 
>>> c = Consumer(channel, helloQ) 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
    File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/messaging.py", line 231, in __init__ 
    self.declare() 
    File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/messaging.py", line 241, in declare 
    queue.declare() 
    File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/entity.py", line 361, in declare 
    return (self.name and self.exchange.declare(nowait), 
    File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/entity.py", line 151, in declare 
nowait=nowait) 
    File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/syn.py", line 14, in blocking 
    return __sync_current(fun, *args, **kwargs) 
    File "/usr/lib/python2.6/site-packages/kombu-1.0.6-py2.6.egg/kombu/syn.py", line 30, in __blocking__ 
    return fun(*args, **kwargs) 
    File "build/bdist.cygwin-1.7.8-i686/egg/amqplib/client_0_8/channel.py", line 839, in exchange_declare 
    File "build/bdist.cygwin-1.7.8-i686/egg/amqplib/client_0_8/abstract_channel.py", line 69, in _send_method 
AttributeError: 'NoneType' object has no attribute 'method_writer' 
+0

我強烈建議不要使用Cygwin,如果你不是僅僅做這個實驗,就使用RabbitMQ。 – 2011-04-26 21:15:05

+0

你能解釋一下Cygwin和它有什麼關係嗎?我通過cygwin運行python,而不是其他的。 – Ramy 2011-04-26 21:33:51

+0

Cygwin不受支持。我檢查了Freenode上的#python頻道。雖然不是100%確定的。 – 2011-04-26 22:53:09

回答

1

添加到@ asksol的答案。如果您正在使用rabbitmq,則可以使用rabbitmqctl命令列出隊列詳細信息,並將這些設置與您自己代碼中的設置進行比較。希望能夠爲您提供足夠的信息來檢測衝突。

1

查看錯誤

amqplib.client_0_8.exceptions.AMQPConnectionException: (530, u"NOT_ALLOWED - parameters for queue 'hello' in vhost 'clippy' not equivalent", (50, 10), 'Channel.queue_declare') 

這意味着隊列中已經聲明,但與其他參數比你 與現在宣佈它。

+0

是的,我明白了。但是什麼參數?這些設置在哪裏?我如何找到設置的參數?它期待什麼,它得到了什麼? – Ramy 2011-04-27 14:02:42