Skip to content

Commit 41f0979

Browse files
committed
Remove IAsyncConnectionFactory
1 parent 275b4eb commit 41f0979

File tree

5 files changed

+13
-61
lines changed

5 files changed

+13
-61
lines changed

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ namespace RabbitMQ.Client
8585
///"amqp://foo/" (note the trailing slash) also represent the
8686
///default virtual host. The latter issue means that virtual
8787
///hosts with an empty name are not addressable. </para></remarks>
88-
public sealed class ConnectionFactory : ConnectionFactoryBase, IAsyncConnectionFactory
88+
public sealed class ConnectionFactory : ConnectionFactoryBase, IConnectionFactory
8989
{
9090
/// <summary>
9191
/// Default value for the desired maximum channel number. Default: 2047.

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

Lines changed: 0 additions & 46 deletions
This file was deleted.

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

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,12 @@ public interface IConnectionFactory
172172
/// </summary>
173173
TimeSpan ContinuationTimeout { get; set; }
174174

175+
/// <summary>
176+
/// Gets or sets a value indicating whether an asynchronous consumer dispatcher which is compatible with <see cref="IAsyncBasicConsumer"/> is used.
177+
/// </summary>
178+
/// <value><see langword="true" /> if an asynchronous consumer dispatcher which is compatible with <see cref="IAsyncBasicConsumer"/> is used; otherwise, <see langword="false" />.</value>
179+
bool DispatchConsumersAsync { get; set; }
180+
175181
/// <summary>
176182
/// Set to a value greater than one to enable concurrent processing. For a concurrency greater than one <see cref="IBasicConsumer"/>
177183
/// will be offloaded to the worker thread pool so it is important to choose the value for the concurrency wisely to avoid thread pool overloading.

projects/RabbitMQ.Client/client/impl/Connection.cs

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -102,14 +102,9 @@ public Connection(IConnectionFactory factory, bool insist, IFrameHandler frameHa
102102
_factory = factory;
103103
_frameHandler = frameHandler;
104104

105-
if (factory is IAsyncConnectionFactory asyncConnectionFactory && asyncConnectionFactory.DispatchConsumersAsync)
106-
{
107-
ConsumerWorkService = new AsyncConsumerWorkService(factory.ConsumerDispatchConcurrency);
108-
}
109-
else
110-
{
111-
ConsumerWorkService = new ConsumerWorkService(factory.ConsumerDispatchConcurrency);
112-
}
105+
ConsumerWorkService = factory.DispatchConsumersAsync
106+
? new AsyncConsumerWorkService(factory.ConsumerDispatchConcurrency)
107+
: new ConsumerWorkService(factory.ConsumerDispatchConcurrency);
113108

114109
_sessionManager = new SessionManager(this, 0);
115110
_session0 = new MainSession(this) { Handler = NotifyReceivedCloseOk };
@@ -154,7 +149,7 @@ public event EventHandler<ShutdownEventArgs> ConnectionShutdown
154149
}
155150
}
156151

157-
152+
158153

159154
public event EventHandler<EventArgs> ConnectionUnblocked;
160155

projects/Unit/APIApproval.Approve.verified.txt

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ namespace RabbitMQ.Client
6969
public BinaryTableValue(byte[] bytes) { }
7070
public byte[] Bytes { get; set; }
7171
}
72-
public sealed class ConnectionFactory : RabbitMQ.Client.ConnectionFactoryBase, RabbitMQ.Client.IAsyncConnectionFactory, RabbitMQ.Client.IConnectionFactory
72+
public sealed class ConnectionFactory : RabbitMQ.Client.ConnectionFactoryBase, RabbitMQ.Client.IConnectionFactory
7373
{
7474
public const ushort DefaultChannelMax = 2047;
7575
public const uint DefaultFrameMax = 0u;
@@ -221,10 +221,6 @@ namespace RabbitMQ.Client
221221
System.Threading.Tasks.Task HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, RabbitMQ.Client.IBasicProperties properties, System.ReadOnlyMemory<byte> body);
222222
System.Threading.Tasks.Task HandleModelShutdown(object model, RabbitMQ.Client.ShutdownEventArgs reason);
223223
}
224-
public interface IAsyncConnectionFactory : RabbitMQ.Client.IConnectionFactory
225-
{
226-
bool DispatchConsumersAsync { get; set; }
227-
}
228224
public interface IAuthMechanism
229225
{
230226
byte[] handleChallenge(byte[] challenge, RabbitMQ.Client.IConnectionFactory factory);
@@ -338,6 +334,7 @@ namespace RabbitMQ.Client
338334
string ClientProvidedName { get; set; }
339335
int ConsumerDispatchConcurrency { get; set; }
340336
System.TimeSpan ContinuationTimeout { get; set; }
337+
bool DispatchConsumersAsync { get; set; }
341338
System.TimeSpan HandshakeContinuationTimeout { get; set; }
342339
string Password { get; set; }
343340
ushort RequestedChannelMax { get; set; }

0 commit comments

Comments
 (0)