Publisher confirms er en mekanisme, hvor RabbitMQ bekræfter over for producenten, at den har modtaget (og persisteret) en meddelelse — hvilket sikrer, at meddelelser ikke går tabt på publiceringssiden. De er producentens modstykke til consumer acknowledgments.
Problemet: nåede meddelelsen til broker'en?
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
Hvordan publisher confirms fungerer
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
