Skip to content

Commit 836d963

Browse files
author
Emile Joubert
committed
Synchronise queue and exchange declaration with Java client
1 parent 6ca4809 commit 836d963

File tree

7 files changed

+26
-39
lines changed

7 files changed

+26
-39
lines changed

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

Lines changed: 16 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -170,18 +170,26 @@ public interface IModel: IDisposable
170170
[return: AmqpFieldMapping(null, "active")]
171171
void ChannelFlow(bool active);
172172

173+
///<summary>(Spec method) Declare an exchange.</summary>
174+
///<remarks>
175+
///The exchange is declared non-passive and non-internal.
176+
///The "nowait" option is not exercised.
177+
///</remarks>
178+
[AmqpMethodDoNotImplement(null)]
179+
void ExchangeDeclare(string exchange,
180+
string type,
181+
bool durable,
182+
bool autoDelete,
183+
IDictionary arguments);
184+
173185
///<summary>(Spec method) Declare an exchange.</summary>
174186
///<remarks>
175187
///The exchange is declared non-passive, non-autodelete, and
176188
///non-internal, with no arguments. The "nowait" option is not
177189
///exercised.
178190
///</remarks>
179191
[AmqpMethodDoNotImplement(null)]
180-
void ExchangeDeclare(string exchange,
181-
string type,
182-
bool durable,
183-
bool autoDelete,
184-
IDictionary arguments);
192+
void ExchangeDeclare(string exchange, string type, bool durable);
185193

186194
///<summary>(Spec method) Declare an exchange.</summary>
187195
///<remarks>
@@ -241,26 +249,15 @@ void ExchangeUnbind(string destination,
241249
[AmqpMethodDoNotImplement(null)]
242250
string QueueDeclare();
243251

244-
///<summary>(Spec method) Declare a queue.</summary>
252+
///<summary>Declare a queue passively.</summary>
245253
///<remarks>
246-
///The queue is declared non-passive, non-durable,
254+
///The queue is declared passive, non-durable,
247255
///non-exclusive, and non-autodelete, with no arguments.
256+
///The queue is declared passively; i.e. only check if it exists.
248257
///</remarks>
249-
[AmqpMethodDoNotImplement(null)]
250-
string QueueDeclare(string queue);
251-
252258
[AmqpMethodDoNotImplement(null)]
253259
string QueueDeclarePassive(string queue);
254260

255-
///<summary>(Spec method) Declare a queue.</summary>
256-
///<remarks>
257-
///The queue is declared non-passive, non-exclusive, and
258-
///non-autodelete, with no arguments.
259-
///</remarks>
260-
[AmqpMethodDoNotImplement(null)]
261-
string QueueDeclare(string queue,
262-
bool durable);
263-
264261
///<summary>(Spec method) Declare a queue.</summary>
265262
[AmqpMethodDoNotImplement(null)]
266263
string QueueDeclare(string queue, bool durable, bool exclusive,

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

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -722,25 +722,15 @@ public abstract void ExchangeUnbind(string destination,
722722
//TODO: Mark these as virtual, maybe the model has an optimized way
723723
// of dealing with missing parameters.
724724
public string QueueDeclare()
725-
{
726-
return _Private_QueueDeclare("", false, false, true, true, false, null);
727-
}
728-
729-
public string QueueDeclare(string queue)
730-
{
731-
return _Private_QueueDeclare(queue, false, false, false, false, false, null);
725+
{
726+
return QueueDeclare("", false, true, true, null);
732727
}
733728

734729
public string QueueDeclarePassive(string queue)
735730
{
736731
return _Private_QueueDeclare(queue, true, false, false, false, false, null);
737732
}
738733

739-
public string QueueDeclare(string queue, bool durable)
740-
{
741-
return _Private_QueueDeclare(queue, false, durable, false, false, false, null);
742-
}
743-
744734
public string QueueDeclare(string queue, bool durable, bool exclusive,
745735
bool autoDelete, IDictionary arguments)
746736
{

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,8 +67,8 @@ public void SendReceive(ConnectionFactory cf) {
6767
IModel ch = conn.CreateModel();
6868

6969
ch.ExchangeDeclare("Exchange_TestSslEndPoint", ExchangeType.Direct);
70-
ch.QueueDeclare("Queue_TestSslEndpoint");
71-
ch.QueueBind("Queue_TestSslEndpoint", "Exchange_TestSslEndPoint", "Key_TestSslEndpoint", false, null);
70+
String qName = ch.QueueDeclare();
71+
ch.QueueBind(qName, "Exchange_TestSslEndPoint", "Key_TestSslEndpoint", false, 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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ public static int Main(string[] args) {
106106
{
107107
using (IModel ch = conn.CreateModel()) {
108108

109-
string finalName = ch.QueueDeclare(inputQueueName, durable,
109+
string finalName = ch.QueueDeclare(inputQueueName, durable,
110110
false, false, arguments);
111111
Console.WriteLine("{0}\t{1}", finalName, durable);
112112

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -86,7 +86,7 @@ public static int Main(string[] args) {
8686
using (IConnection conn = cf.CreateConnection())
8787
{
8888
using (IModel ch = conn.CreateModel()) {
89-
ch.QueueDeclare(routingKey);
89+
ch.QueueDeclare(routingKey, false, true, true, null);
9090
Subscription sub = new Subscription(ch, routingKey);
9191
if (exchange != "") {
9292
ch.ExchangeDeclare(exchange, exchangeType);

projects/examples/client/LowlevelLogTail/src/examples/LowlevelLogTail.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ public static int Main(string[] args) {
8989
{
9090
string queueName;
9191
if (exchange == "") {
92-
ch.QueueDeclare(routingKey);
92+
ch.QueueDeclare(routingKey, false, true, true, null);
9393
queueName = routingKey;
9494
} else {
9595
ch.ExchangeDeclare(exchange, exchangeType);

projects/examples/client/SingleGet/src/examples/SingleGet.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ public static int Main(string[] args) {
7979
conn.ConnectionShutdown += new ConnectionShutdownEventHandler(LogConnClose);
8080

8181
using (IModel ch = conn.CreateModel()) {
82-
conn.AutoClose = true;
83-
84-
ch.QueueDeclare(queueName);
82+
conn.AutoClose = true;
83+
84+
ch.QueueDeclare(queueName, false, true, true, null);
8585
BasicGetResult result = ch.BasicGet(queueName, false);
8686
if (result == null) {
8787
Console.WriteLine("No message available.");

0 commit comments

Comments
 (0)