2323import java .util .concurrent .atomic .AtomicBoolean ;
2424
2525/**
26- * A message that can be manually acknowledged.
26+ * A RabbitMQ {@link Delivery} that can be manually acknowledged or rejected .
2727 */
2828public class AcknowledgableDelivery extends Delivery {
2929
@@ -43,6 +43,13 @@ public AcknowledgableDelivery(Delivery delivery, Channel channel) {
4343 this .channel = channel ;
4444 }
4545
46+ /**
47+ * Acknowledges this message if it has not been previously acked or nacked.
48+ * Subsequent calls to the method for previously acknowledged message will not produce errors and will simply
49+ * return instantly.
50+ * @param multiple Defines whether all messages up to and including the supplied delivery tag should be
51+ * acknowledged or not.
52+ */
4653 public void ack (boolean multiple ) {
4754 if (notAckedOrNacked .getAndSet (false )) {
4855 try {
@@ -57,10 +64,23 @@ public void ack(boolean multiple) {
5764 }
5865 }
5966
67+ /**
68+ * Acknowledges this message if it has not been previously acked or nacked.
69+ * Subsequent calls to the method for previously acknowledged message will not produce errors and will simply
70+ * return instantly.
71+ */
6072 public void ack () {
6173 ack (false );
6274 }
6375
76+ /**
77+ * Rejects this message if it has not been previously acked or nacked.
78+ * Subsequent calls to the method for previously acknowledged or rejected message will not produce errors and
79+ * will simply return instantly.
80+ * @param multiple Defines whether all messages up to and including the supplied delivery tag should be
81+ * rejected or not.
82+ * @param requeue Defines if the message should be added to the queue again instead of being discarded.
83+ */
6484 public void nack (boolean multiple , boolean requeue ) {
6585 if (notAckedOrNacked .getAndSet (false )) {
6686 try {
@@ -75,6 +95,11 @@ public void nack(boolean multiple, boolean requeue) {
7595 }
7696 }
7797
98+ /**
99+ * Rejects this message if it has not been previously acked or nacked.
100+ * Subsequent calls to the method for previously acknowledged or rejected message will not produce errors and
101+ * will simply return instantly.
102+ */
78103 public void nack (boolean requeue ) {
79104 nack (false , requeue );
80105 }
0 commit comments