내 프로듀서 코드에서 소비자가 언제 메시지를 수신했는지 알고 싶습니다. basic.ack
pika confirm_delivery는 브로커가 메시지를 받았을 때 또는 소비자가 승인했을 때를 확인합니까?
channel.confirm_delivery()
과 BlockingConnection
을 사용하면 설명서에서 1) 브로커가 메시지를 받았거나 2) 소비자가이를 수락했다는 것을 확인해야하는지 확실하지 않습니다.
(NO 소비자와)이 코드를 실행 :
import pika
import uuid
# Open a connection to RabbitMQ on localhost using all default parameters
connection = pika.BlockingConnection()
# Open the channel
channel = connection.channel()
queue = str(uuid.uuid4())
# Declare the queue
channel.queue_declare(queue=queue)
# Turn on delivery confirmations
channel.confirm_delivery()
# Send a message
if channel.basic_publish(exchange='',
routing_key=queue,
body='Hello World!',
properties=pika.BasicProperties(
content_type='text/plain',
delivery_mode=1)):
print('Message publish was confirmed')
else:
print('Message could not be confirmed')
를 확인할 수있는 메시지를 보여줍니다. 이것은 내가 기대하거나 원하는 것이 아닙니다. 반환 : basic_publish 설명서에
말한다 그러나
이 Behavior of channels in "confirm" mode with RabbitMQ의 중복 될 수있다 배달 확인이 ( 새앙 토끼 0.10.0의 새로운 기능)를 사용할 수 없습니다 true이고, 메시지 가
어느 날 생각하게한다 (Basic.ack없이 Basic.Return) 배달 된 경우 메시지가 이 (Basic.nack 및/또는 Basic.Return)를 deliveved 트루 할 수없는 경우 그렇지 않은 경우는 false 그것은 내가 원했던 것을 가지고 있어야합니다.
이 문제를 해결해 주셔서 감사합니다. 실제로 이것은 몇 가지 테스트를 통해 밝혀진 것입니다. – Martin