When a publisher enables publisher confirms in RabbitMQ, what is the main effect?
Think about how the publisher knows if the broker accepted the message.
Publisher confirms let the publisher know when the broker has safely received and stored the message, improving reliability.
After enabling publisher confirms on a channel using RabbitMQ client, what output or state change should you expect?
channel.confirmSelect(); System.out.println(channel.waitForConfirms() ? "Confirmed" : "Not Confirmed");
Assuming the broker accepted the message, what does waitForConfirms() return?
waitForConfirms() returns true if all messages were confirmed by the broker, so the output is 'Confirmed'.
When using publisher confirms, the method waitForConfirms() sometimes throws a TimeoutException. What is the most likely cause?
Consider what happens if the broker is slow or unresponsive.
A TimeoutException means the broker did not confirm the message in time, possibly due to network delays or broker overload.
Put the following steps in the correct order to properly use publisher confirms in RabbitMQ.
Think about enabling confirm mode before publishing, then waiting for confirmation.
The correct workflow is to enable confirm mode first, publish the message, wait for confirmation, then handle the result.
When using publisher confirms, what is the best practice to handle messages that receive a negative acknowledgment (nack) from the broker?
Consider how to ensure message delivery reliability after a nack.
When a nack is received, the best practice is to log it and retry sending the message to ensure it is delivered.