diff --git a/src/Custom.Build.props b/src/Custom.Build.props index 87179b5c2..49bee2528 100644 --- a/src/Custom.Build.props +++ b/src/Custom.Build.props @@ -3,6 +3,7 @@ 11.0 minor + preview diff --git a/src/NServiceBus.Transport.RabbitMQ/RabbitMQTransport.cs b/src/NServiceBus.Transport.RabbitMQ/RabbitMQTransport.cs index 3ff85d286..571c396be 100644 --- a/src/NServiceBus.Transport.RabbitMQ/RabbitMQTransport.cs +++ b/src/NServiceBus.Transport.RabbitMQ/RabbitMQTransport.cs @@ -17,12 +17,6 @@ /// public class RabbitMQTransport : TransportDefinition { - TimeSpan heartbeatInterval = TimeSpan.FromSeconds(60); - TimeSpan networkRecoveryInterval = TimeSpan.FromSeconds(10); - Func messageIdStrategy = MessageConverter.DefaultMessageIdStrategy; - PrefetchCountCalculation prefetchCountCalculation = maxConcurrency => 3 * maxConcurrency; - TimeSpan timeToWaitBeforeTriggeringCircuitBreaker = TimeSpan.FromMinutes(2); - readonly List<(string hostName, int port, bool useTls)> additionalClusterNodes = []; /// @@ -72,26 +66,26 @@ public RabbitMQTransport(RoutingTopology routingTopology, string connectionStrin /// public Func MessageIdStrategy { - get => messageIdStrategy; + get; set { ArgumentNullException.ThrowIfNull(value); - messageIdStrategy = value; + field = value; } - } + } = MessageConverter.DefaultMessageIdStrategy; /// /// The time to wait before executing the critical error action when the endpoint cannot communicate with the broker. /// public TimeSpan TimeToWaitBeforeTriggeringCircuitBreaker { - get => timeToWaitBeforeTriggeringCircuitBreaker; + get; set { ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(value, TimeSpan.Zero); - timeToWaitBeforeTriggeringCircuitBreaker = value; + field = value; } - } + } = TimeSpan.FromMinutes(2); /// /// Gets or sets the action that allows customization of the native @@ -114,13 +108,13 @@ public TimeSpan TimeToWaitBeforeTriggeringCircuitBreaker /// public PrefetchCountCalculation PrefetchCountCalculation { - get => prefetchCountCalculation; + get; set { ArgumentNullException.ThrowIfNull(value); - prefetchCountCalculation = value; + field = value; } - } + } = maxConcurrency => 3 * maxConcurrency; /// /// The certificate to use for client authentication when connecting to the broker via TLS. @@ -152,7 +146,7 @@ public PrefetchCountCalculation PrefetchCountCalculation /// /// The broker requirement checks to disable. ///
- /// Using a broker that does not meet all of the requirements can result in message loss or other incorrect operation, so disabling the checks is not recommended. + /// Using a broker that does not meet all the requirements can result in message loss or other incorrect operation, so disabling the checks is not recommended. ///
public BrokerRequirementChecks DisabledBrokerRequirementChecks { get; set; } @@ -161,26 +155,26 @@ public PrefetchCountCalculation PrefetchCountCalculation ///
public TimeSpan HeartbeatInterval { - get => heartbeatInterval; + get; set { ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(value, TimeSpan.Zero); - heartbeatInterval = value; + field = value; } - } + } = TimeSpan.FromSeconds(60); /// /// The time to wait between attempts to reconnect to the broker if the connection is lost. /// public TimeSpan NetworkRecoveryInterval { - get => networkRecoveryInterval; + get; set { ArgumentOutOfRangeException.ThrowIfLessThanOrEqual(value, TimeSpan.Zero); - networkRecoveryInterval = value; + field = value; } - } + } = TimeSpan.FromSeconds(10); /// /// Adds an additional cluster node that the endpoint can use to connect to the broker.