Skip to content

Commit f8ca49d

Browse files
committed
Move convenience overloads of IModel to seprate extension methods class.
Reduce API surface of IModel Introduce the use of optionals on extension convenience methods
1 parent 726a81a commit f8ca49d

File tree

5 files changed

+236
-304
lines changed

5 files changed

+236
-304
lines changed

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

Lines changed: 6 additions & 115 deletions
Original file line numberDiff line numberDiff line change
@@ -38,13 +38,10 @@
3838
// Copyright (c) 2007-2016 Pivotal Software, Inc. All rights reserved.
3939
//---------------------------------------------------------------------------
4040

41-
using RabbitMQ.Client;
4241
using RabbitMQ.Client.Apigen.Attributes;
4342
using RabbitMQ.Client.Events;
44-
using RabbitMQ.Client.Impl;
4543
using System;
4644
using System.Collections.Generic;
47-
using System.IO;
4845

4946
namespace RabbitMQ.Client
5047
{
@@ -195,38 +192,10 @@ public interface IModel : IDisposable
195192
[AmqpMethodDoNotImplement(null)]
196193
void BasicCancel(string consumerTag);
197194

198-
/// <summary>Start a Basic content-class consumer.</summary>
199-
/// <remarks>
200-
/// The consumer is started with noAck=false (i.e. BasicAck is required),
201-
/// an empty consumer tag (i.e. the server creates and returns a fresh consumer tag),
202-
/// noLocal=false and exclusive=false.
203-
/// </remarks>
204-
[AmqpMethodDoNotImplement(null)]
205-
string BasicConsume(string queue, bool noAck, IBasicConsumer consumer);
206-
207-
/// <summary>Start a Basic content-class consumer.</summary>
208-
/// <remarks>
209-
/// The consumer is started with
210-
/// an empty consumer tag (i.e. the server creates and returns a fresh consumer tag),
211-
/// noLocal=false and exclusive=false.
212-
/// </remarks>
213-
[AmqpMethodDoNotImplement(null)]
214-
string BasicConsume(string queue, bool noAck, string consumerTag, IBasicConsumer consumer);
215-
216-
/// <summary>Start a Basic content-class consumer.</summary>
217-
/// <remarks>
218-
/// The consumer is started with noLocal=false and exclusive=false.
219-
/// </remarks>
220-
[AmqpMethodDoNotImplement(null)]
221-
string BasicConsume(string queue,
222-
bool noAck,
223-
string consumerTag,
224-
IDictionary<string, object> arguments,
225-
IBasicConsumer consumer);
226-
227195
/// <summary>Start a Basic content-class consumer.</summary>
228196
[AmqpMethodDoNotImplement(null)]
229-
string BasicConsume(string queue,
197+
string BasicConsume(
198+
string queue,
230199
bool noAck,
231200
string consumerTag,
232201
bool noLocal,
@@ -246,25 +215,7 @@ string BasicConsume(string queue,
246215
void BasicNack(ulong deliveryTag, bool multiple, bool requeue);
247216

248217
/// <summary>
249-
/// (Spec method) Convenience overload of BasicPublish.
250-
/// </summary>
251-
/// <remarks>
252-
/// The publication occurs with mandatory=false and immediate=false.
253-
/// </remarks>
254-
[AmqpMethodDoNotImplement(null)]
255-
void BasicPublish(PublicationAddress addr, IBasicProperties basicProperties, byte[] body);
256-
257-
/// <summary>
258-
/// (Spec method) Convenience overload of BasicPublish.
259-
/// </summary>
260-
/// <remarks>
261-
/// The publication occurs with mandatory=false
262-
/// </remarks>
263-
[AmqpMethodDoNotImplement(null)]
264-
void BasicPublish(string exchange, string routingKey, IBasicProperties basicProperties, byte[] body);
265-
266-
/// <summary>
267-
/// (Spec method) Convenience overload of BasicPublish.
218+
/// (Spec method) Publishes a message.
268219
/// </summary>
269220
[AmqpMethodDoNotImplement(null)]
270221
void BasicPublish(string exchange, string routingKey, bool mandatory,
@@ -332,12 +283,6 @@ void BasicPublish(string exchange, string routingKey, bool mandatory,
332283
[AmqpMethodDoNotImplement(null)]
333284
void ExchangeBind(string destination, string source, string routingKey, IDictionary<string, object> arguments);
334285

335-
/// <summary>
336-
/// (Extension method) Bind an exchange to an exchange.
337-
/// </summary>
338-
[AmqpMethodDoNotImplement(null)]
339-
void ExchangeBind(string destination, string source, string routingKey);
340-
341286
/// <summary>
342287
///Like ExchangeBind but sets nowait to true.
343288
/// </summary>
@@ -353,26 +298,6 @@ void ExchangeBindNoWait(string destination, string source, string routingKey,
353298
void ExchangeDeclare(string exchange, string type, bool durable, bool autoDelete,
354299
IDictionary<string, object> arguments);
355300

356-
/// <summary>
357-
/// (Spec method) Declare an exchange.
358-
/// </summary>
359-
/// <remarks>
360-
/// The exchange is declared non-passive, non-autodelete, and
361-
/// non-internal, with no arguments. The "nowait" option is not exercised.
362-
/// </remarks>
363-
[AmqpMethodDoNotImplement(null)]
364-
void ExchangeDeclare(string exchange, string type, bool durable);
365-
366-
/// <summary>
367-
/// (Spec method) Declare an exchange.
368-
/// </summary>
369-
/// <remarks>
370-
/// The exchange is declared non-passive, non-durable, non-autodelete, and
371-
/// non-internal, with no arguments. The "nowait" option is not exercised.
372-
/// </remarks>
373-
[AmqpMethodDoNotImplement(null)]
374-
void ExchangeDeclare(string exchange, string type);
375-
376301
/// <summary>
377302
/// Same as ExchangeDeclare but sets nowait to true and returns void (as there
378303
/// will be no response from the server).
@@ -395,13 +320,6 @@ void ExchangeDeclareNoWait(string exchange, string type, bool durable, bool auto
395320
[AmqpMethodDoNotImplement(null)]
396321
void ExchangeDelete(string exchange, bool ifUnused);
397322

398-
/// <summary>(Spec method) Delete an exchange.</summary>
399-
/// <remarks>
400-
/// The exchange is deleted regardless of any queue bindings.
401-
/// </remarks>
402-
[AmqpMethodDoNotImplement(null)]
403-
void ExchangeDelete(string exchange);
404-
405323
/// <summary>
406324
///Like ExchangeDelete but sets nowait to true.
407325
/// </summary>
@@ -416,12 +334,6 @@ void ExchangeUnbind(string destination,
416334
string routingKey,
417335
IDictionary<string, object> arguments);
418336

419-
/// <summary>
420-
/// (Extension method) Unbind an exchange from an exchange.
421-
/// </summary>
422-
[AmqpMethodDoNotImplement(null)]
423-
void ExchangeUnbind(string destination, string source, string routingKey);
424-
425337
/// <summary>
426338
/// Like ExchangeUnbind but sets nowait to true.
427339
/// </summary>
@@ -435,22 +347,9 @@ void ExchangeUnbindNoWait(string destination, string source, string routingKey,
435347
[AmqpMethodDoNotImplement(null)]
436348
void QueueBind(string queue, string exchange, string routingKey, IDictionary<string, object> arguments);
437349

438-
/// <summary>(Spec method) Bind a queue to an exchange.</summary>
439-
[AmqpMethodDoNotImplement(null)]
440-
void QueueBind(string queue, string exchange, string routingKey);
441-
442350
/// <summary>Same as QueueBind but sets nowait parameter to true.</summary>
443351
void QueueBindNoWait(string queue, string exchange, string routingKey, IDictionary<string, object> arguments);
444352

445-
/// <summary>(Spec method) Declare a queue.</summary>
446-
/// <remarks>
447-
/// The queue is declared non-passive, non-durable,
448-
/// but exclusive and autodelete, with no arguments. The
449-
/// server autogenerates a name for the queue - the generated name is the return value of this method.
450-
/// </remarks>
451-
[AmqpMethodDoNotImplement(null)]
452-
QueueDeclareOk QueueDeclare();
453-
454353
/// <summary>(Spec method) Declare a queue.</summary>
455354
[AmqpMethodDoNotImplement(null)]
456355
QueueDeclareOk QueueDeclare(string queue, bool durable, bool exclusive,
@@ -460,8 +359,9 @@ QueueDeclareOk QueueDeclare(string queue, bool durable, bool exclusive,
460359
/// Same as QueueDeclare but sets nowait to true and returns void (as there
461360
/// will be no response from the server).
462361
/// </summary>
463-
void QueueDeclareNoWait(string queue, bool durable, bool exclusive,
464-
bool autoDelete, IDictionary<string, object> arguments);
362+
void QueueDeclareNoWait(string queue, bool durable,
363+
bool exclusive, bool autoDelete,
364+
IDictionary<string, object> arguments);
465365

466366
/// <summary>Declare a queue passively.</summary>
467367
/// <remarks>
@@ -500,15 +400,6 @@ void QueueDeclareNoWait(string queue, bool durable, bool exclusive,
500400
[AmqpMethodDoNotImplement(null)]
501401
uint QueueDelete(string queue, bool ifUnused, bool ifEmpty);
502402

503-
/// <summary>
504-
/// (Spec method) Delete a queue.
505-
/// </summary>
506-
/// <remarks>
507-
///Returns the number of messages purged during queue deletion.
508-
/// </remarks>
509-
[AmqpMethodDoNotImplement(null)]
510-
uint QueueDelete(string queue);
511-
512403
/// <summary>
513404
///Same as QueueDelete but sets nowait parameter to true
514405
///and returns void (as there will be no response from the server)

0 commit comments

Comments
 (0)