@@ -38,21 +38,6 @@ namespace RabbitMQ.Client
38
38
{
39
39
public static class IChannelExtensions
40
40
{
41
- #if SYNC_API
42
- /// <summary>Start a Basic content-class consumer.</summary>
43
- public static string BasicConsume ( this IChannel channel ,
44
- IBasicConsumer consumer ,
45
- string queue ,
46
- bool autoAck = false ,
47
- string consumerTag = "" ,
48
- bool noLocal = false ,
49
- bool exclusive = false ,
50
- IDictionary < string , object > arguments = null )
51
- {
52
- return channel . BasicConsume ( queue , autoAck , consumerTag , noLocal , exclusive , arguments , consumer ) ;
53
- }
54
- #endif
55
-
56
41
/// <summary>Asynchronously start a Basic content-class consumer.</summary>
57
42
public static Task < string > BasicConsumeAsync ( this IChannel channel ,
58
43
IBasicConsumer consumer ,
@@ -66,16 +51,6 @@ public static Task<string> BasicConsumeAsync(this IChannel channel,
66
51
return channel . BasicConsumeAsync ( queue , autoAck , consumerTag , noLocal , exclusive , arguments , consumer ) ;
67
52
}
68
53
69
- #if SYNC_API
70
- /// <summary>Start a Basic content-class consumer.</summary>
71
- public static string BasicConsume ( this IChannel channel , string queue ,
72
- bool autoAck ,
73
- IBasicConsumer consumer )
74
- {
75
- return channel . BasicConsume ( queue , autoAck , string . Empty , false , false , null , consumer ) ;
76
- }
77
- #endif
78
-
79
54
/// <summary>Asynchronously start a Basic content-class consumer.</summary>
80
55
public static Task < string > BasicConsumeAsync ( this IChannel channel , string queue ,
81
56
bool autoAck ,
@@ -84,17 +59,6 @@ public static Task<string> BasicConsumeAsync(this IChannel channel, string queue
84
59
return channel . BasicConsumeAsync ( queue , autoAck , string . Empty , false , false , null , consumer ) ;
85
60
}
86
61
87
- #if SYNC_API
88
- /// <summary>Start a Basic content-class consumer.</summary>
89
- public static string BasicConsume ( this IChannel channel , string queue ,
90
- bool autoAck ,
91
- string consumerTag ,
92
- IBasicConsumer consumer )
93
- {
94
- return channel . BasicConsume ( queue , autoAck , consumerTag , false , false , null , consumer ) ;
95
- }
96
- #endif
97
-
98
62
/// <summary>Asynchronously start a Basic content-class consumer.</summary>
99
63
public static Task < string > BasicConsumeAsync ( this IChannel channel , string queue ,
100
64
bool autoAck ,
@@ -104,18 +68,6 @@ public static Task<string> BasicConsumeAsync(this IChannel channel, string queue
104
68
return channel . BasicConsumeAsync ( queue , autoAck , consumerTag , false , false , null , consumer ) ;
105
69
}
106
70
107
- #if SYNC_API
108
- /// <summary>Start a Basic content-class consumer.</summary>
109
- public static string BasicConsume ( this IChannel channel , string queue ,
110
- bool autoAck ,
111
- string consumerTag ,
112
- IDictionary < string , object > arguments ,
113
- IBasicConsumer consumer )
114
- {
115
- return channel . BasicConsume ( queue , autoAck , consumerTag , false , false , arguments , consumer ) ;
116
- }
117
- #endif
118
-
119
71
/// <summary>Asynchronously start a Basic content-class consumer.</summary>
120
72
public static Task < string > BasicConsumeAsync ( this IChannel channel , string queue ,
121
73
bool autoAck ,
@@ -127,13 +79,6 @@ public static Task<string> BasicConsumeAsync(this IChannel channel, string queue
127
79
}
128
80
129
81
#nullable enable
130
- #if SYNC_API
131
- public static void BasicPublish < T > ( this IChannel channel , PublicationAddress addr , in T basicProperties , ReadOnlyMemory < byte > body )
132
- where T : IReadOnlyBasicProperties , IAmqpHeader
133
- {
134
- channel . BasicPublish ( addr . ExchangeName , addr . RoutingKey , in basicProperties , body ) ;
135
- }
136
- #endif
137
82
138
83
/// <summary>
139
84
/// (Extension method) Convenience overload of BasicPublish.
@@ -147,33 +92,13 @@ public static ValueTask BasicPublishAsync<T>(this IChannel channel, PublicationA
147
92
return channel . BasicPublishAsync ( addr . ExchangeName , addr . RoutingKey , in basicProperties , body ) ;
148
93
}
149
94
150
- #if SYNC_API
151
- public static void BasicPublish ( this IChannel channel , string exchange , string routingKey , ReadOnlyMemory < byte > body = default , bool mandatory = false )
152
- => channel . BasicPublish ( exchange , routingKey , in EmptyBasicProperty . Empty , body , mandatory ) ;
153
- #endif
154
-
155
95
public static ValueTask BasicPublishAsync ( this IChannel channel , string exchange , string routingKey , ReadOnlyMemory < byte > body = default , bool mandatory = false )
156
96
=> channel . BasicPublishAsync ( exchange , routingKey , in EmptyBasicProperty . Empty , body , mandatory ) ;
157
97
158
- #if SYNC_API
159
- public static void BasicPublish ( this IChannel channel , CachedString exchange , CachedString routingKey , ReadOnlyMemory < byte > body = default , bool mandatory = false )
160
- => channel . BasicPublish ( exchange , routingKey , in EmptyBasicProperty . Empty , body , mandatory ) ;
161
- #endif
162
-
163
98
public static ValueTask BasicPublishAsync ( this IChannel channel , CachedString exchange , CachedString routingKey , ReadOnlyMemory < byte > body = default , bool mandatory = false )
164
99
=> channel . BasicPublishAsync ( exchange , routingKey , in EmptyBasicProperty . Empty , body , mandatory ) ;
165
- #nullable disable
166
100
167
- #if SYNC_API
168
- /// <summary>
169
- /// Declare a queue.
170
- /// </summary>
171
- public static QueueDeclareOk QueueDeclare ( this IChannel channel , string queue = "" , bool durable = false , bool exclusive = true ,
172
- bool autoDelete = true , IDictionary < string , object > arguments = null )
173
- {
174
- return channel . QueueDeclare ( queue , durable , exclusive , autoDelete , arguments ) ;
175
- }
176
- #endif
101
+ #nullable disable
177
102
178
103
/// <summary>
179
104
/// Asynchronously declare a queue.
@@ -186,35 +111,6 @@ public static Task<QueueDeclareOk> QueueDeclareAsync(this IChannel channel, stri
186
111
arguments : arguments , noWait : noWait ) ;
187
112
}
188
113
189
- #if SYNC_API
190
- /// <summary>
191
- /// Bind an exchange to an exchange.
192
- /// </summary>
193
- public static void ExchangeBind ( this IChannel channel , string destination , string source , string routingKey , IDictionary < string , object > arguments = null )
194
- {
195
- channel . ExchangeBind ( destination , source , routingKey , arguments ) ;
196
- }
197
- #endif
198
-
199
- #if SYNC_API
200
- /// <summary>
201
- /// Like exchange bind but sets nowait to true.
202
- /// </summary>
203
- public static void ExchangeBindNoWait ( this IChannel channel , string destination , string source , string routingKey , IDictionary < string , object > arguments = null )
204
- {
205
- channel . ExchangeBindNoWait ( destination , source , routingKey , arguments ) ;
206
- }
207
-
208
- /// <summary>
209
- /// Declare an exchange.
210
- /// </summary>
211
- public static void ExchangeDeclare ( this IChannel channel , string exchange , string type , bool durable = false , bool autoDelete = false ,
212
- IDictionary < string , object > arguments = null )
213
- {
214
- channel . ExchangeDeclare ( exchange , type , durable , autoDelete , arguments ) ;
215
- }
216
- #endif
217
-
218
114
/// <summary>
219
115
/// Asynchronously declare an exchange.
220
116
/// </summary>
@@ -225,60 +121,6 @@ public static Task ExchangeDeclareAsync(this IChannel channel, string exchange,
225
121
arguments : arguments , passive : false , noWait : noWait ) ;
226
122
}
227
123
228
- #if SYNC_API
229
- /// <summary>
230
- /// Like ExchangeDeclare but sets nowait to true.
231
- /// </summary>
232
- public static void ExchangeDeclareNoWait ( this IChannel channel , string exchange , string type , bool durable = false , bool autoDelete = false ,
233
- IDictionary < string , object > arguments = null )
234
- {
235
- channel . ExchangeDeclareNoWait ( exchange , type , durable , autoDelete , arguments ) ;
236
- }
237
-
238
- /// <summary>
239
- /// Unbinds an exchange.
240
- /// </summary>
241
- public static void ExchangeUnbind ( this IChannel channel , string destination ,
242
- string source ,
243
- string routingKey ,
244
- IDictionary < string , object > arguments = null )
245
- {
246
- channel . ExchangeUnbind ( destination , source , routingKey , arguments ) ;
247
- }
248
-
249
- /// <summary>
250
- /// Deletes an exchange.
251
- /// </summary>
252
- public static void ExchangeDelete ( this IChannel channel , string exchange , bool ifUnused = false )
253
- {
254
- channel . ExchangeDelete ( exchange , ifUnused ) ;
255
- }
256
-
257
- /// <summary>
258
- /// Like ExchangeDelete but sets nowait to true.
259
- /// </summary>
260
- public static void ExchangeDeleteNoWait ( this IChannel channel , string exchange , bool ifUnused = false )
261
- {
262
- channel . ExchangeDeleteNoWait ( exchange , ifUnused ) ;
263
- }
264
-
265
- /// <summary>
266
- /// Binds a queue.
267
- /// </summary>
268
- public static void QueueBind ( this IChannel channel , string queue , string exchange , string routingKey , IDictionary < string , object > arguments = null )
269
- {
270
- channel . QueueBind ( queue , exchange , routingKey , arguments ) ;
271
- }
272
-
273
- /// <summary>
274
- /// Deletes a queue.
275
- /// </summary>
276
- public static uint QueueDelete ( this IChannel channel , string queue , bool ifUnused = false , bool ifEmpty = false )
277
- {
278
- return channel . QueueDelete ( queue , ifUnused , ifEmpty ) ;
279
- }
280
- #endif
281
-
282
124
/// <summary>
283
125
/// Asynchronously deletes a queue.
284
126
/// </summary>
@@ -287,24 +129,6 @@ public static Task<uint> QueueDeleteAsync(this IChannel channel, string queue, b
287
129
return channel . QueueDeleteAsync ( queue , ifUnused , ifEmpty ) ;
288
130
}
289
131
290
- #if SYNC_API
291
- /// <summary>
292
- /// Like QueueDelete but sets nowait to true.
293
- /// </summary>
294
- public static void QueueDeleteNoWait ( this IChannel channel , string queue , bool ifUnused = false , bool ifEmpty = false )
295
- {
296
- channel . QueueDeleteNoWait ( queue , ifUnused , ifEmpty ) ;
297
- }
298
-
299
- /// <summary>
300
- /// Unbinds a queue.
301
- /// </summary>
302
- public static void QueueUnbind ( this IChannel channel , string queue , string exchange , string routingKey , IDictionary < string , object > arguments = null )
303
- {
304
- channel . QueueUnbind ( queue , exchange , routingKey , arguments ) ;
305
- }
306
- #endif
307
-
308
132
/// <summary>
309
133
/// Asynchronously unbinds a queue.
310
134
/// </summary>
@@ -313,24 +137,6 @@ public static Task QueueUnbindAsync(this IChannel channel, string queue, string
313
137
return channel . QueueUnbindAsync ( queue , exchange , routingKey , arguments ) ;
314
138
}
315
139
316
- #if SYNC_API
317
- /// <summary>
318
- /// Abort this session.
319
- /// </summary>
320
- /// <remarks>
321
- /// If the session is already closed (or closing), then this
322
- /// method does nothing but wait for the in-progress close
323
- /// operation to complete. This method will not return to the
324
- /// caller until the shutdown is complete.
325
- /// In comparison to normal <see cref="Close(IChannel)"/> method, <see cref="Abort(IChannel)"/> will not throw
326
- /// <see cref="Exceptions.AlreadyClosedException"/> or <see cref="System.IO.IOException"/> or any other <see cref="Exception"/> during closing channel.
327
- /// </remarks>
328
- public static void Abort ( this IChannel channel )
329
- {
330
- channel . Close ( Constants . ReplySuccess , "Goodbye" , true ) ;
331
- }
332
- #endif
333
-
334
140
/// <summary>
335
141
/// Asynchronously abort this session.
336
142
/// </summary>
@@ -347,38 +153,6 @@ public static Task AbortAsync(this IChannel channel)
347
153
return channel . CloseAsync ( Constants . ReplySuccess , "Goodbye" , true ) ;
348
154
}
349
155
350
- #if SYNC_API
351
- /// <summary>
352
- /// Abort this session.
353
- /// </summary>
354
- /// <remarks>
355
- /// The method behaves in the same way as <see cref="Abort(IChannel)"/>, with the only
356
- /// difference that the channel is closed with the given channel close code and message.
357
- /// <para>
358
- /// The close code (See under "Reply Codes" in the AMQP specification)
359
- /// </para>
360
- /// <para>
361
- /// A message indicating the reason for closing the channel
362
- /// </para>
363
- /// </remarks>
364
- public static void Abort ( this IChannel channel , ushort replyCode , string replyText )
365
- {
366
- channel . Close ( replyCode , replyText , true ) ;
367
- }
368
-
369
- /// <summary>Close this session.</summary>
370
- /// <remarks>
371
- /// If the session is already closed (or closing), then this
372
- /// method does nothing but wait for the in-progress close
373
- /// operation to complete. This method will not return to the
374
- /// caller until the shutdown is complete.
375
- /// </remarks>
376
- public static void Close ( this IChannel channel )
377
- {
378
- channel . Close ( Constants . ReplySuccess , "Goodbye" , false ) ;
379
- }
380
- #endif
381
-
382
156
/// <summary>Asynchronously close this session.</summary>
383
157
/// <remarks>
384
158
/// If the session is already closed (or closing), then this
@@ -391,29 +165,6 @@ public static Task CloseAsync(this IChannel channel)
391
165
return channel . CloseAsync ( Constants . ReplySuccess , "Goodbye" , false ) ;
392
166
}
393
167
394
- #if SYNC_API
395
- /// <summary>
396
- /// Close this channel.
397
- /// </summary>
398
- /// <param name="channel">The channel.</param>
399
- /// <param name="replyCode">The reply code.</param>
400
- /// <param name="replyText">The reply text.</param>
401
- /// <remarks>
402
- /// The method behaves in the same way as Close(), with the only
403
- /// difference that the channel is closed with the given channel
404
- /// close code and message.
405
- /// <para>
406
- /// The close code (See under "Reply Codes" in the AMQP specification)
407
- /// </para><para>
408
- /// A message indicating the reason for closing the channel
409
- /// </para>
410
- /// </remarks>
411
- public static void Close ( this IChannel channel , ushort replyCode , string replyText )
412
- {
413
- channel . Close ( replyCode , replyText , false ) ;
414
- }
415
- #endif
416
-
417
168
/// <summary>
418
169
/// Asynchronously close this channel.
419
170
/// </summary>
0 commit comments