Skip to content

Commit 63a5f33

Browse files
author
Simon MacMullen
committed
stable to default
2 parents 5a390d0 + fb2eccd commit 63a5f33

File tree

3 files changed

+13
-5
lines changed

3 files changed

+13
-5
lines changed

projects/client/RabbitMQ.Client/src/client/api/IModel.cs

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -323,8 +323,7 @@ uint QueueDelete(string queue,
323323
///Waits until all messages published since the last call have
324324
///been either ack'd or nack'd by the broker. Returns whether
325325
///all the messages were ack'd (and none were nack'd). Note,
326-
///when called on a non-Confirm channel, returns true
327-
///immediately.
326+
///throws an exception when called on a non-Confirm channel.
328327
///</remarks>
329328
[AmqpMethodDoNotImplement(null)]
330329
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]
@@ -345,8 +344,7 @@ uint QueueDelete(string queue,
345344
///Waits until all messages published since the last call have
346345
///been either ack'd or nack'd by the broker. Returns whether
347346
///all the messages were ack'd (and none were nack'd). Note,
348-
///when called on a non-Confirm channel, returns true
349-
///immediately.
347+
///throws an exception when called on a non-Confirm channel.
350348
///</remarks>
351349
[AmqpMethodDoNotImplement(null)]
352350
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]

projects/client/RabbitMQ.Client/src/client/impl/ModelBase.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -960,6 +960,9 @@ public void ConfirmSelect()
960960

961961
public bool WaitForConfirms(TimeSpan timeout, out bool timedOut)
962962
{
963+
if (m_nextPubSeqNo == 0UL) {
964+
throw new InvalidOperationException("Confirms not selected");
965+
}
963966
bool isWaitInfinite = (timeout.TotalMilliseconds == Timeout.Infinite);
964967
Stopwatch stopwatch = Stopwatch.StartNew();
965968
lock (m_unconfirmedSet.SyncRoot)

projects/client/Unit/src/unit/TestExtensions.cs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,10 +72,17 @@ public void TestExchangeBinding()
7272
Model.ExchangeDelete("dest");
7373
}
7474

75+
[Test]
76+
public void TestConfirmBeforeWait()
77+
{
78+
Assert.Throws(
79+
typeof (InvalidOperationException),
80+
delegate { Model.WaitForConfirms(); });
81+
}
82+
7583
[Test]
7684
public void TestConfirmBarrier()
7785
{
78-
Assert.That(Model.WaitForConfirms(), Is.Not.False);
7986
Model.ConfirmSelect();
8087
for (int i = 0; i < 10; i++)
8188
Model.BasicPublish("", String.Empty, null, new byte[] { });

0 commit comments

Comments
 (0)