Skip to content

Commit 2c3f1be

Browse files
Introduce IModel#QueueDeleteNowait
1 parent 5fdf6cf commit 2c3f1be

File tree

5 files changed

+96
-21
lines changed

5 files changed

+96
-21
lines changed

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

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,15 @@ uint QueueDelete(string queue,
309309
bool ifUnused,
310310
bool ifEmpty);
311311

312+
///<summary>
313+
///Same as QueueDelete but sets nowait parameter to true
314+
///and returns void (as there will be no response from the server)
315+
///</summary>
316+
void QueueDeleteNowait(string queue,
317+
bool ifUnused,
318+
bool ifEmpty);
319+
320+
312321
///<summary>(Spec method) Delete a queue.</summary>
313322
///<remarks>
314323
///Returns the number of messages purged during queue

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

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -975,6 +975,13 @@ public uint QueueDelete(string queue)
975975
return QueueDelete(queue, false, false);
976976
}
977977

978+
public void QueueDeleteNowait(string queue,
979+
bool ifUnused,
980+
bool ifEmpty)
981+
{
982+
_Private_QueueDelete(queue, ifUnused, ifEmpty, true);
983+
}
984+
978985
public abstract uint _Private_QueueDelete(string queue,
979986
bool ifUnused,
980987
bool ifEmpty,

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

Lines changed: 0 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -85,18 +85,5 @@ public void TestConcurrentQueueDeclare()
8585
Assert.IsNotNull(nse);
8686
Model.ExchangeDelete(x);
8787
}
88-
89-
[Test]
90-
public void TestExchangeDeclareNowait()
91-
{
92-
string x = GenerateExchangeName ();
93-
try
94-
{
95-
Model.ExchangeDeclareNowait(x, "fanout", false, true, null);
96-
Model.ExchangeDeclarePassive(x);
97-
} finally {
98-
Model.ExchangeDelete(x);
99-
}
100-
}
10188
}
10289
}
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
// This source code is dual-licensed under the Apache License, version
2+
// 2.0, and the Mozilla Public License, version 1.1.
3+
//
4+
// The APL v2.0:
5+
//
6+
//---------------------------------------------------------------------------
7+
// Copyright (C) 2007-2014 GoPivotal, Inc.
8+
//
9+
// Licensed under the Apache License, Version 2.0 (the "License");
10+
// you may not use this file except in compliance with the License.
11+
// You may obtain a copy of the License at
12+
//
13+
// http://www.apache.org/licenses/LICENSE-2.0
14+
//
15+
// Unless required by applicable law or agreed to in writing, software
16+
// distributed under the License is distributed on an "AS IS" BASIS,
17+
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18+
// See the License for the specific language governing permissions and
19+
// limitations under the License.
20+
//---------------------------------------------------------------------------
21+
//
22+
// The MPL v1.1:
23+
//
24+
//---------------------------------------------------------------------------
25+
// The contents of this file are subject to the Mozilla Public License
26+
// Version 1.1 (the "License"); you may not use this file except in
27+
// compliance with the License. You may obtain a copy of the License
28+
// at http://www.mozilla.org/MPL/
29+
//
30+
// Software distributed under the License is distributed on an "AS IS"
31+
// basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See
32+
// the License for the specific language governing rights and
33+
// limitations under the License.
34+
//
35+
// The Original Code is RabbitMQ.
36+
//
37+
// The Initial Developer of the Original Code is GoPivotal, Inc.
38+
// Copyright (c) 2007-2014 GoPivotal, Inc. All rights reserved.
39+
//---------------------------------------------------------------------------
40+
41+
using NUnit.Framework;
42+
43+
using System;
44+
using System.Collections.Generic;
45+
46+
using RabbitMQ.Client.Exceptions;
47+
48+
namespace RabbitMQ.Client.Unit {
49+
[TestFixture]
50+
public class TestNowait : IntegrationFixture {
51+
[Test]
52+
public void TestQueueDeclareNowait()
53+
{
54+
string q = GenerateQueueName();
55+
Model.QueueDeclareNowait(q, false, true, false, null);
56+
Model.QueueDeclarePassive(q);
57+
}
58+
59+
[Test]
60+
public void TestQueueDeleteNowait()
61+
{
62+
string q = GenerateQueueName();
63+
Model.QueueDeclareNowait(q, false, true, false, null);
64+
Model.QueueDeleteNowait(q, false, false);
65+
}
66+
67+
[Test]
68+
public void TestExchangeDeclareNowait()
69+
{
70+
string x = GenerateExchangeName ();
71+
try
72+
{
73+
Model.ExchangeDeclareNowait(x, "fanout", false, true, null);
74+
Model.ExchangeDeclarePassive(x);
75+
} finally {
76+
Model.ExchangeDelete(x);
77+
}
78+
}
79+
}
80+
}

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

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -85,13 +85,5 @@ public void TestConcurrentQueueDeclare()
8585
Assert.IsNotNull(nse);
8686
Model.QueueDelete(q);
8787
}
88-
89-
[Test]
90-
public void TestQueueDeclareNowait()
91-
{
92-
string q = GenerateQueueName();
93-
Model.QueueDeclareNowait(q, false, true, false, null);
94-
Model.QueueDeclarePassive(q);
95-
}
9688
}
9789
}

0 commit comments

Comments
 (0)