diff --git a/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs b/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs
index 6f42775186..6339494d08 100644
--- a/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs
+++ b/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs
@@ -85,7 +85,7 @@ namespace RabbitMQ.Client
///"amqp://foo/" (note the trailing slash) also represent the
///default virtual host. The latter issue means that virtual
///hosts with an empty name are not addressable.
- public sealed class ConnectionFactory : ConnectionFactoryBase, IAsyncConnectionFactory
+ public sealed class ConnectionFactory : ConnectionFactoryBase, IConnectionFactory
{
///
/// Default value for the desired maximum channel number. Default: 2047.
diff --git a/projects/RabbitMQ.Client/client/api/IAsyncConnectionFactory.cs b/projects/RabbitMQ.Client/client/api/IAsyncConnectionFactory.cs
deleted file mode 100644
index da201655e4..0000000000
--- a/projects/RabbitMQ.Client/client/api/IAsyncConnectionFactory.cs
+++ /dev/null
@@ -1,46 +0,0 @@
-// This source code is dual-licensed under the Apache License, version
-// 2.0, and the Mozilla Public License, version 2.0.
-//
-// The APL v2.0:
-//
-//---------------------------------------------------------------------------
-// Copyright (c) 2007-2020 VMware, Inc.
-//
-// Licensed under the Apache License, Version 2.0 (the "License");
-// you may not use this file except in compliance with the License.
-// You may obtain a copy of the License at
-//
-// https://www.apache.org/licenses/LICENSE-2.0
-//
-// Unless required by applicable law or agreed to in writing, software
-// distributed under the License is distributed on an "AS IS" BASIS,
-// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-// See the License for the specific language governing permissions and
-// limitations under the License.
-//---------------------------------------------------------------------------
-//
-// The MPL v2.0:
-//
-//---------------------------------------------------------------------------
-// This Source Code Form is subject to the terms of the Mozilla Public
-// License, v. 2.0. If a copy of the MPL was not distributed with this
-// file, You can obtain one at https://mozilla.org/MPL/2.0/.
-//
-// Copyright (c) 2007-2020 VMware, Inc. All rights reserved.
-//---------------------------------------------------------------------------
-
-namespace RabbitMQ.Client
-{
- ///
- /// Defines a connection factory capable of using an asynchronous consumer dispatcher which is compatible with .
- ///
- ///
- public interface IAsyncConnectionFactory : IConnectionFactory
- {
- ///
- /// Gets or sets a value indicating whether an asynchronous consumer dispatcher which is compatible with is used.
- ///
- /// if an asynchronous consumer dispatcher which is compatible with is used; otherwise, .
- bool DispatchConsumersAsync { get; set; }
- }
-}
\ No newline at end of file
diff --git a/projects/RabbitMQ.Client/client/api/IConnectionFactory.cs b/projects/RabbitMQ.Client/client/api/IConnectionFactory.cs
index 261e7c6179..4f8736baa6 100644
--- a/projects/RabbitMQ.Client/client/api/IConnectionFactory.cs
+++ b/projects/RabbitMQ.Client/client/api/IConnectionFactory.cs
@@ -172,6 +172,12 @@ public interface IConnectionFactory
///
TimeSpan ContinuationTimeout { get; set; }
+ ///
+ /// Gets or sets a value indicating whether an asynchronous consumer dispatcher which is compatible with is used.
+ ///
+ /// if an asynchronous consumer dispatcher which is compatible with is used; otherwise, .
+ bool DispatchConsumersAsync { get; set; }
+
///
/// Set to a value greater than one to enable concurrent processing. For a concurrency greater than one
/// 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.
diff --git a/projects/RabbitMQ.Client/client/impl/Connection.cs b/projects/RabbitMQ.Client/client/impl/Connection.cs
index 33df30c10e..3b9753257e 100644
--- a/projects/RabbitMQ.Client/client/impl/Connection.cs
+++ b/projects/RabbitMQ.Client/client/impl/Connection.cs
@@ -102,14 +102,9 @@ public Connection(IConnectionFactory factory, bool insist, IFrameHandler frameHa
_factory = factory;
_frameHandler = frameHandler;
- if (factory is IAsyncConnectionFactory asyncConnectionFactory && asyncConnectionFactory.DispatchConsumersAsync)
- {
- ConsumerWorkService = new AsyncConsumerWorkService(factory.ConsumerDispatchConcurrency);
- }
- else
- {
- ConsumerWorkService = new ConsumerWorkService(factory.ConsumerDispatchConcurrency);
- }
+ ConsumerWorkService = factory.DispatchConsumersAsync
+ ? new AsyncConsumerWorkService(factory.ConsumerDispatchConcurrency)
+ : new ConsumerWorkService(factory.ConsumerDispatchConcurrency);
_sessionManager = new SessionManager(this, 0);
_session0 = new MainSession(this) { Handler = NotifyReceivedCloseOk };
@@ -154,7 +149,7 @@ public event EventHandler ConnectionShutdown
}
}
-
+
public event EventHandler ConnectionUnblocked;
diff --git a/projects/Unit/APIApproval.Approve.verified.txt b/projects/Unit/APIApproval.Approve.verified.txt
index 5ccadb1bcf..5862f0423e 100644
--- a/projects/Unit/APIApproval.Approve.verified.txt
+++ b/projects/Unit/APIApproval.Approve.verified.txt
@@ -69,7 +69,7 @@ namespace RabbitMQ.Client
public BinaryTableValue(byte[] bytes) { }
public byte[] Bytes { get; set; }
}
- public sealed class ConnectionFactory : RabbitMQ.Client.ConnectionFactoryBase, RabbitMQ.Client.IAsyncConnectionFactory, RabbitMQ.Client.IConnectionFactory
+ public sealed class ConnectionFactory : RabbitMQ.Client.ConnectionFactoryBase, RabbitMQ.Client.IConnectionFactory
{
public const ushort DefaultChannelMax = 2047;
public const uint DefaultFrameMax = 0u;
@@ -221,10 +221,6 @@ namespace RabbitMQ.Client
System.Threading.Tasks.Task HandleBasicDeliver(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, RabbitMQ.Client.IBasicProperties properties, System.ReadOnlyMemory body);
System.Threading.Tasks.Task HandleModelShutdown(object model, RabbitMQ.Client.ShutdownEventArgs reason);
}
- public interface IAsyncConnectionFactory : RabbitMQ.Client.IConnectionFactory
- {
- bool DispatchConsumersAsync { get; set; }
- }
public interface IAuthMechanism
{
byte[] handleChallenge(byte[] challenge, RabbitMQ.Client.IConnectionFactory factory);
@@ -338,6 +334,7 @@ namespace RabbitMQ.Client
string ClientProvidedName { get; set; }
int ConsumerDispatchConcurrency { get; set; }
System.TimeSpan ContinuationTimeout { get; set; }
+ bool DispatchConsumersAsync { get; set; }
System.TimeSpan HandshakeContinuationTimeout { get; set; }
string Password { get; set; }
ushort RequestedChannelMax { get; set; }