Publisher confirms は、RabbitMQ がメッセージを受信(および永続化)したことを producer に対して acknowledge する仕組みであり、発行側でメッセージが失われないことを保証します。これは consumer の acknowledgment に対する producer 側の対応物です。
問題:メッセージは broker に届いたのか?
When a producer publishes a message, by default it doesn't KNOW if RabbitMQ received it:
→ network failure, broker issue → the message could be LOST without the producer knowing
→ for reliability, the producer needs CONFIRMATION that the message was accepted
→ publisher confirms address the PUBLISHING side of reliability
publisher confirms の仕組み
PUBLISHER CONFIRMS → the broker sends an ACK back to the producer for each message:
→ enable confirm mode on the channel
→ the broker ACKs a message once it has taken responsibility (received it; for persistent
messages on durable queues → once persisted to disk)
→ NACK → the broker couldn't handle the message (the producer can retry)
→ the producer KNOWS each message was accepted (or not) → no silent loss
