Skip to content

Commit 28ba841

Browse files
author
Emile Joubert
committed
Remove no-wait from API
1 parent 61598db commit 28ba841

File tree

9 files changed

+173
-97
lines changed

9 files changed

+173
-97
lines changed

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

Lines changed: 91 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -207,36 +207,29 @@ void ExchangeDeclare(string exchange,
207207
[AmqpMethodDoNotImplement(null)]
208208
void ExchangeDeclarePassive(string exchange);
209209

210-
///<summary>(Spec method) Delete an exchange.</summary>
211-
void ExchangeDelete(string exchange,
212-
bool ifUnused,
213-
[AmqpNowaitArgument(null)]
214-
bool nowait);
210+
///<summary>(Spec method) Delete an exchange.</summary>
211+
[AmqpMethodDoNotImplement(null)]
212+
void ExchangeDelete(string exchange, bool ifUnused);
215213

216-
///<summary>(Spec method) Delete an exchange.</summary>
214+
///<summary>(Spec method) Delete an exchange.</summary>
215+
///<remarks>
216+
/// The exchange is deleted regardless of any queue bindings.
217+
///</remarks>
217218
[AmqpMethodDoNotImplement(null)]
218219
void ExchangeDelete(string exchange);
219220

220-
///<summary>(Spec method) Bind an exchange to an exchange.</summary>
221-
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8"),
222-
AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid"),
223-
AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
221+
///<summary>(Extension method) Bind an exchange to an exchange.</summary>
222+
[AmqpMethodDoNotImplement(null)]
224223
void ExchangeBind(string destination,
225224
string source,
226225
string routingKey,
227-
[AmqpNowaitArgument(null)]
228-
bool nowait,
229-
IDictionary arguments);
230-
231-
///<summary>(Spec method) Unbind an exchange from an exchange.</summary>
232-
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8"),
233-
AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid"),
234-
AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
226+
IDictionary arguments);
227+
228+
///<summary>(Extension method) Unbind an exchange from an exchange.</summary>
229+
[AmqpMethodDoNotImplement(null)]
235230
void ExchangeUnbind(string destination,
236231
string source,
237232
string routingKey,
238-
[AmqpNowaitArgument(null)]
239-
bool nowait,
240233
IDictionary arguments);
241234

242235
///<summary>(Spec method) Declare a queue.</summary>
@@ -263,12 +256,11 @@ void ExchangeUnbind(string destination,
263256
string QueueDeclare(string queue, bool durable, bool exclusive,
264257
bool autoDelete, IDictionary arguments);
265258

266-
///<summary>(Spec method) Bind a queue to an exchange.</summary>
259+
///<summary>(Spec method) Bind a queue to an exchange.</summary>
260+
[AmqpMethodDoNotImplement(null)]
267261
void QueueBind(string queue,
268262
string exchange,
269263
string routingKey,
270-
[AmqpNowaitArgument(null)]
271-
bool nowait,
272264
IDictionary arguments);
273265

274266
///<summary>(Spec method) Unbind a queue from an exchange.</summary>
@@ -286,26 +278,21 @@ void QueueUnbind(string queue,
286278

287279
///<summary>(Spec method) Purge a queue of messages.</summary>
288280
///<remarks>
289-
///Returns the number of messages purged. If nowait is
290-
///specified, returns <code>uint.MaxValue</code>.
291-
///</remarks>
292-
[return: AmqpFieldMapping(null, "messageCount")]
293-
uint QueuePurge(string queue,
294-
[AmqpNowaitArgument(null, "0xFFFFFFFF")]
295-
bool nowait);
281+
///Returns the number of messages purged.
282+
///</remarks>
283+
[AmqpMethodDoNotImplement(null)]
284+
uint QueuePurge(string queue);
296285

297286
///<summary>(Spec method) Delete a queue.</summary>
298287
///<remarks>
299288
///Returns the number of messages purged during queue
300-
///deletion. If nowait is specified, returns
289+
///deletion.
301290
///<code>uint.MaxValue</code>.
302-
///</remarks>
303-
[return: AmqpFieldMapping(null, "messageCount")]
291+
///</remarks>
292+
[AmqpMethodDoNotImplement(null)]
304293
uint QueueDelete(string queue,
305294
bool ifUnused,
306-
bool ifEmpty,
307-
[AmqpNowaitArgument(null, "0xFFFFFFFF")]
308-
bool nowait);
295+
bool ifEmpty);
309296

310297
///<summary>(Spec method) Delete a queue.</summary>
311298
///<remarks>
@@ -322,14 +309,6 @@ uint QueueDelete(string queue,
322309
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
323310
void ConfirmSelect();
324311

325-
///<summary>Enable publisher acknowledgements.</summary>
326-
[AmqpMethodDoNotImplement(null)]
327-
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]
328-
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8")]
329-
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
330-
void ConfirmSelect(bool nowait);
331-
332-
333312
///<summary>Start a Basic content-class consumer.</summary>
334313
///<remarks>
335314
///The consumer is started with noAck=false (i.e. BasicAck is required),
@@ -601,7 +580,44 @@ void _Private_ExchangeDeclare(string exchange,
601580
bool @internal,
602581
[AmqpNowaitArgument(null)]
603582
bool nowait,
604-
IDictionary arguments);
583+
IDictionary arguments);
584+
585+
///<summary>Used to send a Exchange.Delete method. Called by the
586+
///public delete method.
587+
///</summary>
588+
[AmqpMethodMapping(null, "exchange", "delete")]
589+
void _Private_ExchangeDelete(string exchange,
590+
bool ifUnused,
591+
[AmqpNowaitArgument(null)]
592+
bool nowait);
593+
594+
///<summary>Used to send a Exchange.Bind method. Called by the
595+
///public bind method.
596+
///</summary>
597+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8"),
598+
AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid"),
599+
AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
600+
[AmqpMethodMapping(null, "exchange", "bind")]
601+
void _Private_ExchangeBind(string destination,
602+
string source,
603+
string routingKey,
604+
[AmqpNowaitArgument(null)]
605+
bool nowait,
606+
IDictionary arguments);
607+
608+
///<summary>Used to send a Exchange.Unbind method. Called by the
609+
///public unbind method.
610+
///</summary>
611+
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8"),
612+
AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid"),
613+
AmqpUnsupported("RabbitMQ.Client.Framing.v0_9")]
614+
[AmqpMethodMapping(null, "exchange", "unbind")]
615+
void _Private_ExchangeUnbind(string destination,
616+
string source,
617+
string routingKey,
618+
[AmqpNowaitArgument(null)]
619+
bool nowait,
620+
IDictionary arguments);
605621

606622
///<summary>Used to send a Queue.Declare method. Called by the
607623
///public declare method.</summary>
@@ -614,7 +630,36 @@ string _Private_QueueDeclare(string queue,
614630
bool autoDelete,
615631
[AmqpNowaitArgument(null)]
616632
bool nowait,
617-
IDictionary arguments);
633+
IDictionary arguments);
634+
635+
///<summary>Used to send a Queue.Bind method. Called by the
636+
///public bind method.</summary>
637+
[AmqpMethodMapping(null, "queue", "bind")]
638+
void _Private_QueueBind(string queue,
639+
string exchange,
640+
string routingKey,
641+
[AmqpNowaitArgument(null)]
642+
bool nowait,
643+
IDictionary arguments);
644+
645+
///<summary>Used to send a Queue.Purge method. Called by the
646+
///public purge method.</summary>
647+
[return: AmqpFieldMapping(null, "messageCount")]
648+
[AmqpMethodMapping(null, "queue", "purge")]
649+
uint _Private_QueuePurge(string queue,
650+
[AmqpNowaitArgument(null, "0xFFFFFFFF")]
651+
bool nowait);
652+
653+
654+
///<summary>Used to send a Queue.Delete method. Called by the
655+
///public delete method.</summary>
656+
[AmqpMethodMapping(null, "queue", "delete")]
657+
[return: AmqpFieldMapping(null, "messageCount")]
658+
uint _Private_QueueDelete(string queue,
659+
bool ifUnused,
660+
bool ifEmpty,
661+
[AmqpNowaitArgument(null, "0xFFFFFFFF")]
662+
bool nowait);
618663

619664
///<summary>Used to send a Basic.Publish method. Called by the
620665
///public publish method after potential null-reference issues

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

Lines changed: 74 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -698,26 +698,48 @@ public abstract void _Private_ExchangeDeclare(string exchange,
698698
bool nowait,
699699
IDictionary arguments);
700700

701-
public abstract void ExchangeDelete(string exchange,
702-
bool ifUnused,
703-
bool nowait);
701+
public void ExchangeDelete(string exchange,
702+
bool ifUnused)
703+
{
704+
_Private_ExchangeDelete(exchange, ifUnused, false);
705+
}
704706

705707
public void ExchangeDelete(string exchange)
706708
{
707-
ExchangeDelete(exchange, false, false);
708-
}
709+
ExchangeDelete(exchange, false);
710+
}
711+
712+
public abstract void _Private_ExchangeDelete(string exchange,
713+
bool ifUnused,
714+
bool nowait);
709715

710-
public abstract void ExchangeBind(string destination,
711-
string source,
712-
string routingKey,
713-
bool nowait,
714-
IDictionary arguments);
716+
public void ExchangeBind(string destination,
717+
string source,
718+
string routingKey,
719+
IDictionary arguments)
720+
{
721+
_Private_ExchangeBind(destination, source, routingKey, false, arguments);
722+
}
723+
724+
public abstract void _Private_ExchangeBind(string destination,
725+
string source,
726+
string routingKey,
727+
bool nowait,
728+
IDictionary arguments);
715729

716-
public abstract void ExchangeUnbind(string destination,
717-
string source,
718-
string routingKey,
719-
bool nowait,
720-
IDictionary arguments);
730+
public void ExchangeUnbind(string destination,
731+
string source,
732+
string routingKey,
733+
IDictionary arguments)
734+
{
735+
_Private_ExchangeUnbind(destination, source, routingKey, false, arguments);
736+
}
737+
738+
public abstract void _Private_ExchangeUnbind(string destination,
739+
string source,
740+
string routingKey,
741+
bool nowait,
742+
IDictionary arguments);
721743

722744
//TODO: Mark these as virtual, maybe the model has an optimized way
723745
// of dealing with missing parameters.
@@ -745,40 +767,56 @@ public abstract string _Private_QueueDeclare(string queue,
745767
bool nowait,
746768
IDictionary arguments);
747769

748-
public abstract void QueueBind(string queue,
749-
string exchange,
750-
string routingKey,
751-
bool nowait,
752-
IDictionary arguments);
770+
public void QueueBind(string queue,
771+
string exchange,
772+
string routingKey,
773+
IDictionary arguments)
774+
{
775+
_Private_QueueBind(queue, exchange, routingKey, false, arguments);
776+
}
777+
778+
public abstract void _Private_QueueBind(string queue,
779+
string exchange,
780+
string routingKey,
781+
bool nowait,
782+
IDictionary arguments);
753783

754784
public abstract void QueueUnbind(string queue,
755785
string exchange,
756786
string routingKey,
757787
IDictionary arguments);
758788

759-
public abstract uint QueuePurge(string queue,
760-
bool nowait);
789+
public uint QueuePurge(string queue)
790+
{
791+
return _Private_QueuePurge(queue, false);
792+
}
793+
794+
public abstract uint _Private_QueuePurge(string queue,
795+
bool nowait);
761796

762-
public abstract uint QueueDelete(string queue,
763-
bool ifUnused,
764-
bool ifEmpty,
765-
bool nowait);
766797

767-
public uint QueueDelete(string queue)
768-
{
769-
return QueueDelete(queue, false, false, false);
798+
public uint QueueDelete(string queue,
799+
bool ifUnused,
800+
bool ifEmpty)
801+
{
802+
return _Private_QueueDelete(queue, ifUnused, ifEmpty, false);
770803
}
771804

772-
public void ConfirmSelect() {
773-
ConfirmSelect(false);
774-
}
805+
public uint QueueDelete(string queue)
806+
{
807+
return QueueDelete(queue, false, false);
808+
}
809+
810+
public abstract uint _Private_QueueDelete(string queue,
811+
bool ifUnused,
812+
bool ifEmpty,
813+
bool nowait);
775814

776-
public void ConfirmSelect(bool nowait) {
777-
m_nextPubSeqNo = 1;
778-
_Private_ConfirmSelect(nowait);
815+
public void ConfirmSelect() {
816+
m_nextPubSeqNo = 1;
817+
_Private_ConfirmSelect(false);
779818
}
780819

781-
782820
public abstract void _Private_ConfirmSelect(bool nowait);
783821

784822
public string BasicConsume(string queue,

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

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ [SetUp] public void Connect()
8383
[TearDown] public void Disconnect()
8484
{
8585
try {
86-
Channel.ExchangeDelete(exchangeName, false, false);
86+
Channel.ExchangeDelete(exchangeName);
8787
} catch (OperationInterruptedException) {}
8888
Connection.Abort();
8989
}
@@ -94,12 +94,5 @@ public void TestExchangeDeclare()
9494
Channel.ExchangeDeclare(exchangeName, "direct",
9595
false, false, null);
9696
}
97-
98-
[Test]
99-
public void TestExchangeDeleteNoWait()
100-
{
101-
Channel.ExchangeDeclare(exchangeName, "direct");
102-
Channel.ExchangeDelete(exchangeName, false, true);
103-
}
10497
}
10598
}

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public void SendReceive(ConnectionFactory cf) {
6868

6969
ch.ExchangeDeclare("Exchange_TestSslEndPoint", ExchangeType.Direct);
7070
String qName = ch.QueueDeclare();
71-
ch.QueueBind(qName, "Exchange_TestSslEndPoint", "Key_TestSslEndpoint", false, null);
71+
ch.QueueBind(qName, "Exchange_TestSslEndPoint", "Key_TestSslEndpoint", null);
7272

7373
string message = "Hello C# SSL Client World";
7474
byte[] msgBytes = System.Text.Encoding.UTF8.GetBytes(message);

projects/examples/client/DeclareQueue/src/examples/DeclareQueue.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,12 +113,12 @@ public static int Main(string[] args) {
113113
while ((optionIndex + 1) < args.Length) {
114114
string exchange = args[optionIndex++];
115115
string routingKey = args[optionIndex++];
116-
ch.QueueBind(finalName, exchange, routingKey, false, null);
116+
ch.QueueBind(finalName, exchange, routingKey, null);
117117
Console.WriteLine("{0}\t{1}\t{2}", finalName, exchange, routingKey);
118118
}
119119

120120
if (delete) {
121-
ch.QueueDelete(finalName, false, false, false);
121+
ch.QueueDelete(finalName);
122122
}
123123

124124
return 0;

projects/examples/client/LogTail/src/examples/LogTail.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ public static int Main(string[] args) {
9090
Subscription sub = new Subscription(ch, routingKey);
9191
if (exchange != "") {
9292
ch.ExchangeDeclare(exchange, exchangeType);
93-
ch.QueueBind(routingKey, exchange, routingKey, false, null);
93+
ch.QueueBind(routingKey, exchange, routingKey, null);
9494
}
9595

9696
Console.WriteLine("Consumer tag: " + sub.ConsumerTag);

0 commit comments

Comments
 (0)