diff --git a/projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs b/projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs index 7d0c0dbeea..a0df763517 100644 --- a/projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs +++ b/projects/client/RabbitMQ.Client/src/client/api/ConnectionFactory.cs @@ -153,9 +153,10 @@ public class ConnectionFactory : ConnectionFactoryBase, IConnectionFactory public IList AuthMechanisms { get; set; } = DefaultAuthMechanisms; /// - /// Set to true to enable automatic connection recovery. + /// Set to false to disable automatic connection recovery. + /// Defaults to true. /// - public bool AutomaticRecoveryEnabled { get; set; } + public bool AutomaticRecoveryEnabled { get; set; } = true; /// The host to connect to. public string HostName { get; set; } = "localhost"; @@ -230,7 +231,8 @@ public TimeSpan ContinuationTimeout public SslOption Ssl { get; set; } = new SslOption(); /// - /// Set to true to make automatic connection recovery also recover topology (exchanges, queues, bindings, etc). + /// Set to false to make automatic connection recovery not recover topology (exchanges, queues, bindings, etc). + /// Defaults to true. /// public bool TopologyRecoveryEnabled { get; set; } = true; diff --git a/projects/client/Unit/src/unit/Fixtures.cs b/projects/client/Unit/src/unit/Fixtures.cs index a4032928d0..6c9de7470a 100755 --- a/projects/client/Unit/src/unit/Fixtures.cs +++ b/projects/client/Unit/src/unit/Fixtures.cs @@ -149,6 +149,8 @@ protected AutorecoveringConnection CreateAutorecoveringConnectionWithTopologyRec protected IConnection CreateNonRecoveringConnection() { var cf = new ConnectionFactory(); + cf.AutomaticRecoveryEnabled = false; + cf.TopologyRecoveryEnabled = false; return cf.CreateConnection(); } diff --git a/projects/client/Unit/src/unit/TestChannelAllocation.cs b/projects/client/Unit/src/unit/TestChannelAllocation.cs index 2c0c22e879..660501f454 100644 --- a/projects/client/Unit/src/unit/TestChannelAllocation.cs +++ b/projects/client/Unit/src/unit/TestChannelAllocation.cs @@ -55,7 +55,7 @@ public class TestIModelAllocation public int ModelNumber(IModel model) { - return ((ModelBase)model).Session.ChannelNumber; + return ((ModelBase)((AutorecoveringModel)model).Delegate).Session.ChannelNumber; } [SetUp] public void Connect() diff --git a/projects/client/Unit/src/unit/TestConnectionShutdown.cs b/projects/client/Unit/src/unit/TestConnectionShutdown.cs index e8003a2612..934789b1bb 100644 --- a/projects/client/Unit/src/unit/TestConnectionShutdown.cs +++ b/projects/client/Unit/src/unit/TestConnectionShutdown.cs @@ -65,7 +65,7 @@ public void TestShutdownSignalPropagationToChannels() [Test] public void TestConsumerDispatcherShutdown() { - var m = (ModelBase)Model; + var m = (AutorecoveringModel)Model; var latch = new ManualResetEvent(false); this.Model.ModelShutdown += (model, args) => diff --git a/projects/client/Unit/src/unit/TestModelShutdown.cs b/projects/client/Unit/src/unit/TestModelShutdown.cs index 252c0fc4b2..598957e5b9 100755 --- a/projects/client/Unit/src/unit/TestModelShutdown.cs +++ b/projects/client/Unit/src/unit/TestModelShutdown.cs @@ -51,7 +51,7 @@ internal class TestModelShutdown : IntegrationFixture [Test] public void TestConsumerDispatcherShutdown() { - var m = (ModelBase)Model; + var m = (AutorecoveringModel)Model; var latch = new ManualResetEvent(false); this.Model.ModelShutdown += (model, args) =>