Publisher confirms เป็นกลไกที่ RabbitMQ ยืนยันกลับไปยัง producer ว่าได้รับ (และ persist) message แล้ว — เพื่อให้แน่ใจว่า message ไม่สูญหายฝั่ง publish มันเป็นคู่ขนานฝั่ง producer ของ consumer acknowledgment
ปัญหา: message ถึง 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
