Skip to content

Commit bf8f424

Browse files
committed
Fix plurars
Signed-off-by: Gabriele Santomaggio <[email protected]>
1 parent 66db630 commit bf8f424

File tree

5 files changed

+70
-6
lines changed

5 files changed

+70
-6
lines changed

RabbitMQ.AMQP.Client/IEntities.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,3 +43,16 @@ public interface IQueueDeletion
4343
// TODO consider returning a QueueStatus object with some info after deletion
4444
Task<IEntityInfo> Delete(string name);
4545
}
46+
47+
public interface IExchangeSpecification : IEntityDeclaration<IExchangeInfo>
48+
{
49+
IExchangeSpecification Name(string name);
50+
51+
IExchangeSpecification AutoDelete(bool autoDelete);
52+
53+
IExchangeSpecification Type(ExchangeType type);
54+
55+
IExchangeSpecification Type(string type);
56+
57+
IExchangeSpecification Argument(string key, object value);
58+
}

RabbitMQ.AMQP.Client/IQueueInfo.cs renamed to RabbitMQ.AMQP.Client/IEntitiesInfo.cs

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,3 +29,15 @@ public interface IQueueInfo : IEntityInfo
2929

3030
uint ConsumerCount();
3131
}
32+
33+
34+
public enum ExchangeType {
35+
DIRECT,
36+
FANOUT,
37+
TOPIC,
38+
HEADERS
39+
}
40+
41+
public interface IExchangeInfo : IEntityInfo
42+
{
43+
}
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
namespace RabbitMQ.AMQP.Client.Impl;
2+
3+
public class AmqpExchangeSpecification : IExchangeSpecification
4+
{
5+
6+
private string _name = "";
7+
private bool _autoDelete;
8+
private ExchangeType _type;
9+
private string _typeString = "";
10+
11+
12+
public Task<IExchangeInfo> Declare() => throw new NotImplementedException();
13+
14+
public IExchangeSpecification Name(string name)
15+
{
16+
_name = name;
17+
return this;
18+
}
19+
20+
public IExchangeSpecification AutoDelete(bool autoDelete)
21+
{
22+
_autoDelete = autoDelete;
23+
return this;
24+
}
25+
26+
public IExchangeSpecification Type(ExchangeType type)
27+
{
28+
_type = type;
29+
return this;
30+
}
31+
32+
public IExchangeSpecification Type(string type)
33+
{
34+
_typeString = type;
35+
return this;
36+
}
37+
38+
public IExchangeSpecification Argument(string key, object value) => throw new NotImplementedException();
39+
}

RabbitMQ.AMQP.Client/Impl/AmqpPublisherBuilder.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -47,10 +47,10 @@ public string Address()
4747

4848
if (!string.IsNullOrEmpty(_key))
4949
{
50-
return "/exchange/" + _exchange + "/key/" + _key;
50+
return "/exchanges/" + _exchange + "/key/" + _key;
5151
}
5252

53-
return "/exchange/" + _exchange;
53+
return "/exchanges/" + _exchange;
5454
}
5555

5656
if (_queue == null)
@@ -63,7 +63,7 @@ public string Address()
6363
throw new InvalidAddressException("Queue must be set");
6464
}
6565

66-
return "/queue/" + _queue;
66+
return "/queues/" + _queue;
6767
}
6868
}
6969

RabbitMQ.AMQP.Client/Impl/AmqpQueueSpecification.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,7 @@ internal DefaultQueueInfo(Map response)
3131
: m.ToDictionary(kv => (string)kv.Key, kv => kv.Value);
3232

3333
_leader = (string)response["leader"];
34-
var replicas = (string[])response["replicas"];
34+
string[]? replicas = (string[])response["replicas"];
3535
_replicas = replicas.Length == 0 ? [] : [.. replicas];
3636
_messageCount = (ulong)response["message_count"];
3737
_consumerCount = (uint)response["consumer_count"];
@@ -139,7 +139,7 @@ public IQueueSpecification AutoDelete(bool autoDelete)
139139

140140
public IQueueSpecification Arguments(Dictionary<object, object> arguments)
141141
{
142-
foreach (var (key, value) in arguments)
142+
foreach ((object key, object value) in arguments)
143143
{
144144
_arguments[key] = value;
145145
}
@@ -150,7 +150,7 @@ public IQueueSpecification Arguments(Dictionary<object, object> arguments)
150150
public Dictionary<object, object> Arguments()
151151
{
152152
var result = new Dictionary<object, object>();
153-
foreach (var (key, value) in _arguments)
153+
foreach ((object? key, object? value) in _arguments)
154154
{
155155
result[key] = value;
156156
}

0 commit comments

Comments
 (0)