큐가 존재하는 경우에도 " 대기열이있을 때에도 passive="True"
을 설정하여 쿼리 할 때는"queue_declare "새앙 토끼 반환 '없음에서"설정하여 쿼리 수동 = "진정한"나는 말 큐에서 데이터를 소비하는 소비자를 위해 새앙 토끼를 사용하고
웹 인터페이스를 사용하여 "전자 메일"대기열을 만들고 그 대기열이 있음을 알 수 있습니다 (타사가 대기열을 생성해야합니다.)
내 프로그램에서 채널을 열었을 때부터 시작하기 전에 n은 이메일 큐, 나는 큐가 이미 있는지 확인하려면, 그래서 True
로 passive
을 설정
def message(channel, envelope, properties, body):
if send(envelope.routing_key, body):
channel.basic_ack(envelope.delivery_tag)
return
print("Could not send message.")
def channel_open(channel):
QUEUES = CONFIG._defaults['queues']
queuelist = QUEUES.split(",")
for queuename in queuelist:
result = channel.queue_declare(message,queue=queuename, passive=True)
if not result:
raise NameError("declare the queues specified "
"in default config section first")
channel.basic_consume(queue=queuename, consumer_callback=message)
내가 결과를 얻을 것은 "None
"나는 얻기 위해 기다리고 있었다 동안 "ok
" 대기열이 이미 존재하므로 모든 포인터 ??? 웹 UI를 사용하여 대기열을 선언 할 때 콜백이 지정되지 않았기 때문입니까? 큐가 있는지 알기를 원하지만 pika queue_declare
함수는 인수로 콜백 함수를 호출하고 하나가 주어지지 않을 때 불평합니다.
http://pika.readthedocs.org/en/latest/examples/asynchronous_consumer_example.html ..하지만 난 너무 basic_get에서 없음을 얻을 :
검사 문서에서이 예제를 method_frame, header_frame, body = channel.basic_get (message, queuename) method_frame.NAME == 'Basic.GetEmpty'인 경우 : – user2574872
이것은 비동기 소비자입니다. – user2574872