Publisher Confirms is a RabbitMQ feature that lets a message sender know when a message has been safely received and stored by the broker. It helps ensure messages are not lost.
Click to reveal answer
beginner
How does a publisher enable confirms in RabbitMQ?
The publisher enables confirms by putting the channel into confirm mode using the command channel.confirmSelect(). This tells RabbitMQ to send acknowledgments for published messages.
Click to reveal answer
beginner
What does a positive confirmation (ack) from RabbitMQ mean?
A positive confirmation (ack) means RabbitMQ has received and stored the message safely. The publisher can then consider the message delivered.
Click to reveal answer
intermediate
What should a publisher do if it receives a negative confirmation (nack)?
If the publisher receives a negative confirmation (nack), it means the message was not processed correctly. The publisher should retry sending the message or handle the failure accordingly.
Click to reveal answer
intermediate
Why are Publisher Confirms preferred over transactions in RabbitMQ?
Publisher Confirms are faster and more efficient than transactions because they allow asynchronous acknowledgments without blocking the publisher, improving performance.
Click to reveal answer
How does a publisher enable Publisher Confirms in RabbitMQ?
ABy calling <code>channel.confirmSelect()</code>
BBy starting a transaction with <code>channel.txSelect()</code>
CBy setting <code>autoAck=true</code>
DBy declaring a durable queue
✗ Incorrect
The publisher enables confirms by calling channel.confirmSelect() to put the channel into confirm mode.
What does a positive confirmation (ack) from RabbitMQ indicate?
AMessage was lost
BMessage was expired
CMessage was rejected
DMessage was received and stored safely
✗ Incorrect
A positive confirmation means RabbitMQ has safely received and stored the message.
What should a publisher do when it receives a negative confirmation (nack)?
AIgnore it
BRetry sending the message or handle failure
CClose the connection immediately
DDelete the queue
✗ Incorrect
A negative confirmation means the message was not processed correctly, so the publisher should retry or handle the failure.
Why are Publisher Confirms preferred over transactions in RabbitMQ?
AThey allow asynchronous acknowledgments and improve performance
BThey block the publisher
CThey require manual message deletion
DThey are slower but safer
✗ Incorrect
Publisher Confirms allow asynchronous acknowledgments without blocking, making them faster and more efficient than transactions.
Which RabbitMQ feature helps ensure messages are not lost after publishing?
AExclusive queues
BAuto-delete queues
CPublisher Confirms
DMessage TTL
✗ Incorrect
Publisher Confirms help the publisher know when messages are safely stored, reducing message loss.
Explain how Publisher Confirms work in RabbitMQ and why they are useful.
Think about how the publisher knows the message is safe.
You got /4 concepts.
Describe the steps a publisher should take when using Publisher Confirms to handle message delivery.
Consider the message lifecycle from sending to confirmation.
You got /4 concepts.
Practice
(1/5)
1. What does enabling publisher confirms in RabbitMQ do?
easy
A. It automatically retries sending messages on failure.
B. It encrypts messages before sending.
C. It tells you if RabbitMQ accepted your message.
D. It queues messages without sending them.
Solution
Step 1: Understand the purpose of publisher confirms
Publisher confirms notify the sender if the message was accepted by RabbitMQ.
Step 2: Compare with other options
Retrying, encrypting, or queuing without sending are unrelated to confirms.
Final Answer:
It tells you if RabbitMQ accepted your message. -> Option C
A. confirmSelect() must be called before basicPublish()
B. waitForConfirms() cannot be called after publishing
C. basicPublish() requires a callback parameter
D. confirmSelect() should be called after waitForConfirms()
Solution
Step 1: Check order of method calls
confirmSelect() must be called before publishing to enable confirms.
Step 2: Identify the error
In the snippet, confirmSelect() is called after basicPublish(), so confirms are not enabled when publishing.
Final Answer:
confirmSelect() must be called before basicPublish() -> Option A
Quick Check:
Enable confirms before publishing [OK]
Hint: Call confirmSelect() before publishing messages [OK]
Common Mistakes:
Calling confirmSelect() after publishing
Thinking waitForConfirms() disables confirms
Believing basicPublish() needs a callback for confirms
5. You want to ensure your application only proceeds after RabbitMQ confirms message acceptance. Which sequence of calls correctly implements this using publisher confirms?
hard
A. channel.confirmSelect(); channel.basicPublish(...); channel.waitForConfirms();
B. channel.basicPublish(...); channel.waitForConfirms(); channel.confirmSelect();
C. channel.waitForConfirms(); channel.confirmSelect(); channel.basicPublish(...);
D. channel.basicPublish(...); channel.confirmSelect(); channel.waitForConfirms();
Solution
Step 1: Enable confirms before publishing
Call confirmSelect() first to enable confirms on the channel.
Step 2: Publish the message and wait for confirmation
After basicPublish(...), call waitForConfirms() to block until RabbitMQ confirms acceptance.
Final Answer:
channel.confirmSelect(); channel.basicPublish(...); channel.waitForConfirms(); -> Option A
Quick Check:
Enable confirms, publish, then wait [OK]
Hint: Enable confirms, publish, then waitForConfirms() [OK]
Common Mistakes:
Calling confirmSelect() after publishing
Waiting for confirms before publishing
Not calling waitForConfirms() at all
Recommended
Ready to prove it?
Pass the test and this pattern moves unknownstrongwhile earning +1 Grip toward your certificate.