Skip to content

Commit 12791b0

Browse files
committed
* Delete code for sync API
1 parent 3383830 commit 12791b0

File tree

10 files changed

+1
-1656
lines changed

10 files changed

+1
-1656
lines changed

projects/RabbitMQ.Client/client/api/IChannel.cs

Lines changed: 0 additions & 321 deletions
Large diffs are not rendered by default.

projects/RabbitMQ.Client/client/api/IChannelExtensions.cs

Lines changed: 1 addition & 250 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,6 @@ namespace RabbitMQ.Client
3838
{
3939
public static class IChannelExtensions
4040
{
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-
5641
/// <summary>Asynchronously start a Basic content-class consumer.</summary>
5742
public static Task<string> BasicConsumeAsync(this IChannel channel,
5843
IBasicConsumer consumer,
@@ -66,16 +51,6 @@ public static Task<string> BasicConsumeAsync(this IChannel channel,
6651
return channel.BasicConsumeAsync(queue, autoAck, consumerTag, noLocal, exclusive, arguments, consumer);
6752
}
6853

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-
7954
/// <summary>Asynchronously start a Basic content-class consumer.</summary>
8055
public static Task<string> BasicConsumeAsync(this IChannel channel, string queue,
8156
bool autoAck,
@@ -84,17 +59,6 @@ public static Task<string> BasicConsumeAsync(this IChannel channel, string queue
8459
return channel.BasicConsumeAsync(queue, autoAck, string.Empty, false, false, null, consumer);
8560
}
8661

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-
9862
/// <summary>Asynchronously start a Basic content-class consumer.</summary>
9963
public static Task<string> BasicConsumeAsync(this IChannel channel, string queue,
10064
bool autoAck,
@@ -104,18 +68,6 @@ public static Task<string> BasicConsumeAsync(this IChannel channel, string queue
10468
return channel.BasicConsumeAsync(queue, autoAck, consumerTag, false, false, null, consumer);
10569
}
10670

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-
11971
/// <summary>Asynchronously start a Basic content-class consumer.</summary>
12072
public static Task<string> BasicConsumeAsync(this IChannel channel, string queue,
12173
bool autoAck,
@@ -127,13 +79,6 @@ public static Task<string> BasicConsumeAsync(this IChannel channel, string queue
12779
}
12880

12981
#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
13782

13883
/// <summary>
13984
/// (Extension method) Convenience overload of BasicPublish.
@@ -147,33 +92,13 @@ public static ValueTask BasicPublishAsync<T>(this IChannel channel, PublicationA
14792
return channel.BasicPublishAsync(addr.ExchangeName, addr.RoutingKey, in basicProperties, body);
14893
}
14994

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-
15595
public static ValueTask BasicPublishAsync(this IChannel channel, string exchange, string routingKey, ReadOnlyMemory<byte> body = default, bool mandatory = false)
15696
=> channel.BasicPublishAsync(exchange, routingKey, in EmptyBasicProperty.Empty, body, mandatory);
15797

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-
16398
public static ValueTask BasicPublishAsync(this IChannel channel, CachedString exchange, CachedString routingKey, ReadOnlyMemory<byte> body = default, bool mandatory = false)
16499
=> channel.BasicPublishAsync(exchange, routingKey, in EmptyBasicProperty.Empty, body, mandatory);
165-
#nullable disable
166100

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
177102

178103
/// <summary>
179104
/// Asynchronously declare a queue.
@@ -186,35 +111,6 @@ public static Task<QueueDeclareOk> QueueDeclareAsync(this IChannel channel, stri
186111
arguments: arguments, noWait: noWait);
187112
}
188113

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-
218114
/// <summary>
219115
/// Asynchronously declare an exchange.
220116
/// </summary>
@@ -225,60 +121,6 @@ public static Task ExchangeDeclareAsync(this IChannel channel, string exchange,
225121
arguments: arguments, passive: false, noWait: noWait);
226122
}
227123

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-
282124
/// <summary>
283125
/// Asynchronously deletes a queue.
284126
/// </summary>
@@ -287,24 +129,6 @@ public static Task<uint> QueueDeleteAsync(this IChannel channel, string queue, b
287129
return channel.QueueDeleteAsync(queue, ifUnused, ifEmpty);
288130
}
289131

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-
308132
/// <summary>
309133
/// Asynchronously unbinds a queue.
310134
/// </summary>
@@ -313,24 +137,6 @@ public static Task QueueUnbindAsync(this IChannel channel, string queue, string
313137
return channel.QueueUnbindAsync(queue, exchange, routingKey, arguments);
314138
}
315139

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-
334140
/// <summary>
335141
/// Asynchronously abort this session.
336142
/// </summary>
@@ -347,38 +153,6 @@ public static Task AbortAsync(this IChannel channel)
347153
return channel.CloseAsync(Constants.ReplySuccess, "Goodbye", true);
348154
}
349155

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-
382156
/// <summary>Asynchronously close this session.</summary>
383157
/// <remarks>
384158
/// If the session is already closed (or closing), then this
@@ -391,29 +165,6 @@ public static Task CloseAsync(this IChannel channel)
391165
return channel.CloseAsync(Constants.ReplySuccess, "Goodbye", false);
392166
}
393167

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-
417168
/// <summary>
418169
/// Asynchronously close this channel.
419170
/// </summary>

projects/RabbitMQ.Client/client/api/IConnection.cs

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -217,18 +217,6 @@ public interface IConnection : INetworkConnection, IDisposable
217217
/// TODO rabbitmq-dotnet-client-1472 async
218218
void UpdateSecret(string newSecret, string reason);
219219

220-
#if SYNC_API
221-
/// <summary>
222-
/// Close this connection and all its channels
223-
/// and wait with a timeout for all the in-progress close operations to complete.
224-
/// </summary>
225-
/// <param name="reasonCode">The close code (See under "Reply Codes" in the AMQP 0-9-1 specification).</param>
226-
/// <param name="reasonText">A message indicating the reason for closing the connection.</param>
227-
/// <param name="timeout">Operation timeout.</param>
228-
/// <param name="abort">Whether or not this close is an abort (ignores certain exceptions).</param>
229-
void Close(ushort reasonCode, string reasonText, TimeSpan timeout, bool abort);
230-
#endif
231-
232220
/// <summary>
233221
/// Asynchronously close this connection and all its channels
234222
/// and wait with a timeout for all the in-progress close operations to complete.

0 commit comments

Comments
 (0)