@@ -9,15 +9,10 @@ public static class RabbitMqMessageBusSettingsExtensions
9
9
/// <param name="action">Action to be executed, the first param is the RabbitMQ <see cref="IModel"/> from the underlying client, and second parameter represents the SMB exchange, queue and binding setup</param>
10
10
public static RabbitMqMessageBusSettings UseTopologyInitializer ( this RabbitMqMessageBusSettings settings , RabbitMqTopologyInitializer action )
11
11
{
12
- #if NETSTANDARD2_0
13
12
if ( settings is null ) throw new ArgumentNullException ( nameof ( settings ) ) ;
14
13
if ( action is null ) throw new ArgumentNullException ( nameof ( action ) ) ;
15
- #else
16
- ArgumentNullException . ThrowIfNull ( settings ) ;
17
- ArgumentNullException . ThrowIfNull ( action ) ;
18
- #endif
19
14
20
- settings . Properties [ RabbitMqProperties . TopologyInitializer ] = action ;
15
+ RabbitMqProperties . TopologyInitializer . Set ( settings , action ) ;
21
16
return settings ;
22
17
}
23
18
@@ -32,11 +27,11 @@ public static RabbitMqMessageBusSettings UseExchangeDefaults(this RabbitMqMessag
32
27
{
33
28
if ( durable != null )
34
29
{
35
- settings . Properties [ RabbitMqProperties . ExchangeDurable ] = durable . Value ;
30
+ RabbitMqProperties . ExchangeDurable . Set ( settings , durable . Value ) ;
36
31
}
37
32
if ( autoDelete != null )
38
33
{
39
- settings . Properties [ RabbitMqProperties . ExchangeAutoDelete ] = autoDelete . Value ;
34
+ RabbitMqProperties . ExchangeAutoDelete . Set ( settings , autoDelete . Value ) ;
40
35
}
41
36
return settings ;
42
37
}
@@ -45,28 +40,28 @@ public static RabbitMqMessageBusSettings UseExchangeDefaults(this RabbitMqMessag
45
40
/// Sets the default settings for dead letter exchanges on the bus level. This default will be taken unless it is overridden at the relevant producer level.
46
41
/// </summary>
47
42
/// <param name="settings"></param>
48
- /// <param name="exchangeType"></param>
43
+ /// <param name="exchangeType">See <see cref="ExchangeType"/> </param>
49
44
/// <param name="durable"></param>
50
45
/// <param name="autoDelete"></param>
51
46
/// <param name="routingKey"></param>
52
47
/// <returns></returns>
53
- public static RabbitMqMessageBusSettings UseDeadLetterExchangeDefaults ( this RabbitMqMessageBusSettings settings , ExchangeType ? exchangeType = null , bool ? durable = null , bool ? autoDelete = null , string routingKey = null )
48
+ public static RabbitMqMessageBusSettings UseDeadLetterExchangeDefaults ( this RabbitMqMessageBusSettings settings , string exchangeType = null , bool ? durable = null , bool ? autoDelete = null , string routingKey = null )
54
49
{
55
50
if ( exchangeType != null )
56
51
{
57
- settings . Properties [ RabbitMqProperties . DeadLetterExchangeType ] = RabbitMqProducerBuilderExtensions . MapExchangeType ( exchangeType . Value ) ;
52
+ RabbitMqProperties . DeadLetterExchangeType . Set ( settings , exchangeType ) ;
58
53
}
59
54
if ( durable != null )
60
55
{
61
- settings . Properties [ RabbitMqProperties . DeadLetterExchangeDurable ] = durable . Value ;
56
+ RabbitMqProperties . DeadLetterExchangeDurable . Set ( settings , durable . Value ) ;
62
57
}
63
58
if ( autoDelete != null )
64
59
{
65
- settings . Properties [ RabbitMqProperties . DeadLetterExchangeAutoDelete ] = autoDelete . Value ;
60
+ RabbitMqProperties . DeadLetterExchangeAutoDelete . Set ( settings , autoDelete . Value ) ;
66
61
}
67
62
if ( routingKey != null )
68
63
{
69
- settings . Properties [ RabbitMqProperties . DeadLetterExchangeRoutingKey ] = routingKey ;
64
+ RabbitMqProperties . DeadLetterExchangeRoutingKey . Set ( settings , routingKey ) ;
70
65
}
71
66
return settings ;
72
67
}
@@ -80,19 +75,15 @@ public static RabbitMqMessageBusSettings UseDeadLetterExchangeDefaults(this Rabb
80
75
/// <returns></returns>
81
76
public static RabbitMqMessageBusSettings UseQueueDefaults ( this RabbitMqMessageBusSettings settings , bool ? durable = null , bool ? autoDelete = null )
82
77
{
83
- #if NETSTANDARD2_0
84
78
if ( settings is null ) throw new ArgumentNullException ( nameof ( settings ) ) ;
85
- #else
86
- ArgumentNullException . ThrowIfNull ( settings ) ;
87
- #endif
88
79
89
80
if ( durable != null )
90
81
{
91
- settings . Properties [ RabbitMqProperties . QueueDurable ] = durable . Value ;
82
+ RabbitMqProperties . QueueDurable . Set ( settings , durable . Value ) ;
92
83
}
93
84
if ( autoDelete != null )
94
85
{
95
- settings . Properties [ RabbitMqProperties . QueueAutoDelete ] = autoDelete . Value ;
86
+ RabbitMqProperties . QueueAutoDelete . Set ( settings , autoDelete . Value ) ;
96
87
}
97
88
return settings ;
98
89
}
@@ -105,15 +96,10 @@ public static RabbitMqMessageBusSettings UseQueueDefaults(this RabbitMqMessageBu
105
96
/// <returns></returns>
106
97
public static RabbitMqMessageBusSettings UseMessagePropertiesModifier ( this RabbitMqMessageBusSettings settings , RabbitMqMessagePropertiesModifier < object > messagePropertiesModifier )
107
98
{
108
- #if NETSTANDARD2_0
109
99
if ( settings is null ) throw new ArgumentNullException ( nameof ( settings ) ) ;
110
100
if ( messagePropertiesModifier is null ) throw new ArgumentNullException ( nameof ( messagePropertiesModifier ) ) ;
111
- #else
112
- ArgumentNullException . ThrowIfNull ( settings ) ;
113
- ArgumentNullException . ThrowIfNull ( messagePropertiesModifier ) ;
114
- #endif
115
101
116
- settings . Properties [ RabbitMqProperties . MessagePropertiesModifier ] = messagePropertiesModifier ;
102
+ RabbitMqProperties . MessagePropertiesModifier . Set ( settings , messagePropertiesModifier ) ;
117
103
return settings ;
118
104
}
119
105
@@ -125,15 +111,10 @@ public static RabbitMqMessageBusSettings UseMessagePropertiesModifier(this Rabbi
125
111
/// <returns></returns>
126
112
public static RabbitMqMessageBusSettings UseRoutingKeyProvider ( this RabbitMqMessageBusSettings settings , RabbitMqMessageRoutingKeyProvider < object > routingKeyProvider )
127
113
{
128
- #if NETSTANDARD2_0
129
114
if ( settings is null ) throw new ArgumentNullException ( nameof ( settings ) ) ;
130
115
if ( routingKeyProvider is null ) throw new ArgumentNullException ( nameof ( routingKeyProvider ) ) ;
131
- #else
132
- ArgumentNullException . ThrowIfNull ( settings ) ;
133
- ArgumentNullException . ThrowIfNull ( routingKeyProvider ) ;
134
- #endif
135
116
136
- settings . Properties [ RabbitMqProperties . MessageRoutingKeyProvider ] = routingKeyProvider ;
117
+ RabbitMqProperties . MessageRoutingKeyProvider . Set ( settings , routingKeyProvider ) ;
137
118
return settings ;
138
119
}
139
120
@@ -145,13 +126,9 @@ public static RabbitMqMessageBusSettings UseRoutingKeyProvider(this RabbitMqMess
145
126
/// <returns></returns>
146
127
public static RabbitMqMessageBusSettings AcknowledgementMode ( this RabbitMqMessageBusSettings settings , RabbitMqMessageAcknowledgementMode mode )
147
128
{
148
- #if NETSTANDARD2_0
149
129
if ( settings is null ) throw new ArgumentNullException ( nameof ( settings ) ) ;
150
- #else
151
- ArgumentNullException . ThrowIfNull ( settings ) ;
152
- #endif
153
130
154
- settings . Properties [ RabbitMqProperties . MessageAcknowledgementMode ] = mode ;
131
+ RabbitMqProperties . MessageAcknowledgementMode . Set ( settings , mode ) ;
155
132
return settings ;
156
133
}
157
134
}
0 commit comments