Skip to content

Commit cb31f99

Browse files
author
Emile Joubert
committed
Merged default into bug22942
2 parents 572f9f7 + c018e27 commit cb31f99

File tree

3 files changed

+105
-46
lines changed

3 files changed

+105
-46
lines changed

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

Lines changed: 52 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -189,24 +189,22 @@ public interface IModel: IDisposable
189189
void ExchangeDeclare(string exchange, string type);
190190

191191
///<summary>(Spec method) Declare an exchange.</summary>
192-
void ExchangeDeclare(string exchange,
193-
string type,
194-
bool passive,
195-
bool durable,
196-
[AmqpFieldMapping("RabbitMQ.Client.Framing.v0_9_1", "reserved2")]
197-
bool autoDelete,
198-
[AmqpFieldMapping("RabbitMQ.Client.Framing.v0_9_1", "reserved3")]
199-
bool @internal,
200-
[AmqpNowaitArgument(null)]
201-
bool nowait,
202-
IDictionary arguments);
192+
///<remarks>
193+
/// The exchange is declared passive.
194+
/// </remarks>
195+
[AmqpMethodDoNotImplement(null)]
196+
void ExchangeDeclarePassive(string exchange);
203197

204198
///<summary>(Spec method) Delete an exchange.</summary>
205199
void ExchangeDelete(string exchange,
206200
bool ifUnused,
207201
[AmqpNowaitArgument(null)]
208202
bool nowait);
209203

204+
///<summary>(Spec method) Delete an exchange.</summary>
205+
[AmqpMethodDoNotImplement(null)]
206+
void ExchangeDelete(string exchange);
207+
210208
///<summary>(Spec method) Bind an exchange to an exchange.</summary>
211209
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8"),
212210
AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid"),
@@ -247,6 +245,9 @@ void ExchangeUnbind(string destination,
247245
[AmqpMethodDoNotImplement(null)]
248246
string QueueDeclare(string queue);
249247

248+
[AmqpMethodDoNotImplement(null)]
249+
string QueueDeclarePassive(string queue);
250+
250251
///<summary>(Spec method) Declare a queue.</summary>
251252
///<remarks>
252253
///The queue is declared non-passive, non-exclusive, and
@@ -257,18 +258,9 @@ string QueueDeclare(string queue,
257258
bool durable);
258259

259260
///<summary>(Spec method) Declare a queue.</summary>
260-
///<remarks>
261-
///Returns the name of the queue that was declared.
262-
///</remarks>
263-
[return: AmqpFieldMapping(null, "queue")]
264-
string QueueDeclare(string queue,
265-
bool passive,
266-
bool durable,
267-
bool exclusive,
268-
bool autoDelete,
269-
[AmqpNowaitArgument(null)]
270-
bool nowait,
271-
IDictionary arguments);
261+
[AmqpMethodDoNotImplement(null)]
262+
string QueueDeclare(string queue, bool durable, bool exclusive,
263+
bool autoDelete, IDictionary arguments);
272264

273265
///<summary>(Spec method) Bind a queue to an exchange.</summary>
274266
void QueueBind(string queue,
@@ -314,6 +306,14 @@ uint QueueDelete(string queue,
314306
[AmqpNowaitArgument(null, "0xFFFFFFFF")]
315307
bool nowait);
316308

309+
///<summary>(Spec method) Delete a queue.</summary>
310+
///<remarks>
311+
///Returns the number of messages purged during queue
312+
///deletion.
313+
///</remarks>
314+
[AmqpMethodDoNotImplement(null)]
315+
uint QueueDelete(string queue);
316+
317317
///<summary>Enable publisher acknowledgements.</summary>
318318
[AmqpMethodDoNotImplement(null)]
319319
[AmqpUnsupported("RabbitMQ.Client.Framing.v0_8qpid")]
@@ -582,6 +582,35 @@ namespace RabbitMQ.Client.Impl
582582
///<see cref="RabbitMQ.Client.Framing.Impl.v0_9.Model"/>
583583
public interface IFullModel : RabbitMQ.Client.IModel
584584
{
585+
///<summary>Used to send a Exchange.Declare method. Called by the
586+
///public declare method.
587+
///</summary>
588+
[AmqpMethodMapping(null, "exchange", "declare")]
589+
void _Private_ExchangeDeclare(string exchange,
590+
string type,
591+
bool passive,
592+
bool durable,
593+
[AmqpFieldMapping("RabbitMQ.Client.Framing.v0_9_1", "reserved2")]
594+
bool autoDelete,
595+
[AmqpFieldMapping("RabbitMQ.Client.Framing.v0_9_1", "reserved3")]
596+
bool @internal,
597+
[AmqpNowaitArgument(null)]
598+
bool nowait,
599+
IDictionary arguments);
600+
601+
///<summary>Used to send a Queue.Declare method. Called by the
602+
///public declare method.</summary>
603+
[AmqpMethodMapping(null, "queue", "declare")]
604+
[return: AmqpFieldMapping(null, "queue")]
605+
string _Private_QueueDeclare(string queue,
606+
bool passive,
607+
bool durable,
608+
bool exclusive,
609+
bool autoDelete,
610+
[AmqpNowaitArgument(null)]
611+
bool nowait,
612+
IDictionary arguments);
613+
585614
///<summary>Used to send a Basic.Publish method. Called by the
586615
///public publish method after potential null-reference issues
587616
///have been rectified.</summary>

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

Lines changed: 51 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -669,29 +669,44 @@ public void FinishClose()
669669

670670
public abstract void ChannelFlow(bool active);
671671

672+
public void ExchangeDeclare(string exchange, string type, bool durable, bool autoDelete, IDictionary arguments)
673+
{
674+
_Private_ExchangeDeclare(exchange, type, false, durable, autoDelete, false, false, arguments);
675+
}
676+
672677
public void ExchangeDeclare(string exchange, string type, bool durable)
673678
{
674-
ExchangeDeclare(exchange, type, false, durable, false, false, false, null);
679+
ExchangeDeclare(exchange, type, durable, false, null);
675680
}
676681

677682
public void ExchangeDeclare(string exchange, string type)
678683
{
679-
ExchangeDeclare(exchange, type, false, false, false, false, false, null);
684+
ExchangeDeclare(exchange, type, false);
685+
}
686+
687+
public void ExchangeDeclarePassive(string exchange)
688+
{
689+
_Private_ExchangeDeclare(exchange, "", true, false, false, false, false, null);
680690
}
681691

682-
public abstract void ExchangeDeclare(string exchange,
683-
string type,
684-
bool passive,
685-
bool durable,
686-
bool autoDelete,
687-
bool @internal,
688-
bool nowait,
689-
IDictionary arguments);
692+
public abstract void _Private_ExchangeDeclare(string exchange,
693+
string type,
694+
bool passive,
695+
bool durable,
696+
bool autoDelete,
697+
bool @internal,
698+
bool nowait,
699+
IDictionary arguments);
690700

691701
public abstract void ExchangeDelete(string exchange,
692702
bool ifUnused,
693703
bool nowait);
694704

705+
public void ExchangeDelete(string exchange)
706+
{
707+
ExchangeDelete(exchange, false, false);
708+
}
709+
695710
public abstract void ExchangeBind(string destination,
696711
string source,
697712
string routingKey,
@@ -708,26 +723,37 @@ public abstract void ExchangeUnbind(string destination,
708723
// of dealing with missing parameters.
709724
public string QueueDeclare()
710725
{
711-
return QueueDeclare("", false, false, true, true, false, null);
726+
return _Private_QueueDeclare("", false, false, true, true, false, null);
712727
}
713728

714729
public string QueueDeclare(string queue)
715730
{
716-
return QueueDeclare(queue, false);
731+
return _Private_QueueDeclare(queue, false, false, false, false, false, null);
732+
}
733+
734+
public string QueueDeclarePassive(string queue)
735+
{
736+
return _Private_QueueDeclare(queue, true, false, false, false, false, null);
717737
}
718738

719739
public string QueueDeclare(string queue, bool durable)
720740
{
721-
return QueueDeclare(queue, false, durable, false, false, false, null);
741+
return _Private_QueueDeclare(queue, false, durable, false, false, false, null);
722742
}
723743

724-
public abstract string QueueDeclare(string queue,
725-
bool passive,
726-
bool durable,
727-
bool exclusive,
728-
bool autoDelete,
729-
bool nowait,
730-
IDictionary arguments);
744+
public string QueueDeclare(string queue, bool durable, bool exclusive,
745+
bool autoDelete, IDictionary arguments)
746+
{
747+
return _Private_QueueDeclare(queue, false, durable, exclusive, autoDelete, false, arguments);
748+
}
749+
750+
public abstract string _Private_QueueDeclare(string queue,
751+
bool passive,
752+
bool durable,
753+
bool exclusive,
754+
bool autoDelete,
755+
bool nowait,
756+
IDictionary arguments);
731757

732758
public abstract void QueueBind(string queue,
733759
string exchange,
@@ -748,6 +774,11 @@ public abstract uint QueueDelete(string queue,
748774
bool ifEmpty,
749775
bool nowait);
750776

777+
public uint QueueDelete(string queue)
778+
{
779+
return QueueDelete(queue, false, false, false);
780+
}
781+
751782
public void ConfirmSelect(bool multiple) {
752783
ConfirmSelect(multiple, false);
753784
}

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

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -106,9 +106,8 @@ public static int Main(string[] args) {
106106
{
107107
using (IModel ch = conn.CreateModel()) {
108108

109-
string finalName = ch.QueueDeclare(inputQueueName, false,
110-
durable, false, false,
111-
false, arguments);
109+
string finalName = ch.QueueDeclare(inputQueueName, durable,
110+
false, false, arguments);
112111
Console.WriteLine("{0}\t{1}", finalName, durable);
113112

114113
while ((optionIndex + 1) < args.Length) {

0 commit comments

Comments
 (0)