|
18 | 18 |
|
19 | 19 | import java.io.IOException; |
20 | 20 | import java.util.Map; |
| 21 | +import java.util.concurrent.TimeoutException; |
21 | 22 |
|
22 | 23 | import com.rabbitmq.client.AMQP.BasicProperties; |
23 | 24 | import com.rabbitmq.client.AMQP.Exchange; |
@@ -726,13 +727,31 @@ void basicNack(long deliveryTag, boolean multiple, boolean requeue) |
726 | 727 | */ |
727 | 728 | boolean waitForConfirms() throws InterruptedException; |
728 | 729 |
|
| 730 | + /** |
| 731 | + * Wait until all messages published since the last call have been |
| 732 | + * either ack'd or nack'd by the broker; or until timeout elapses. |
| 733 | + * If the timeout expires a TimeoutException is thrown. When |
| 734 | + * called on a non-Confirm channel, waitForConfirms returns true |
| 735 | + * immediately. |
| 736 | + * @return whether all the messages were ack'd (and none were nack'd) |
| 737 | + */ |
| 738 | + boolean waitForConfirms(long timeout) throws InterruptedException, TimeoutException; |
| 739 | + |
729 | 740 | /** Wait until all messages published since the last call have |
730 | 741 | * been either ack'd or nack'd by the broker. If any of the |
731 | 742 | * messages were nack'd, waitForConfirmsOrDie will throw an |
732 | 743 | * IOException. When called on a non-Confirm channel, it will |
733 | 744 | * return immediately. */ |
734 | 745 | void waitForConfirmsOrDie() throws IOException, InterruptedException; |
735 | 746 |
|
| 747 | + /** Wait until all messages published since the last call have |
| 748 | + * been either ack'd or nack'd by the broker; or until timeout elapses. |
| 749 | + * If the timeout expires a TimeoutException is thrown. If any of the |
| 750 | + * messages were nack'd, waitForConfirmsOrDie will throw an |
| 751 | + * IOException. When called on a non-Confirm channel, it will |
| 752 | + * return immediately. */ |
| 753 | + void waitForConfirmsOrDie(long timeout) throws IOException, InterruptedException, TimeoutException; |
| 754 | + |
736 | 755 | /** |
737 | 756 | * Asynchronously send a method over this channel. |
738 | 757 | * @param method method to transmit over this channel. |
|
0 commit comments