diff --git a/projects/RabbitMQ.Client/PublicAPI.Unshipped.txt b/projects/RabbitMQ.Client/PublicAPI.Unshipped.txt index 46ef5bfffc..fc9c98161b 100644 --- a/projects/RabbitMQ.Client/PublicAPI.Unshipped.txt +++ b/projects/RabbitMQ.Client/PublicAPI.Unshipped.txt @@ -5,7 +5,6 @@ const RabbitMQ.Client.ConnectionFactory.DefaultChannelMax = 2047 -> ushort const RabbitMQ.Client.ConnectionFactory.DefaultFrameMax = 0 -> uint const RabbitMQ.Client.ConnectionFactory.DefaultMaxInboundMessageBodySize = 67108864 -> uint const RabbitMQ.Client.ConnectionFactory.DefaultPass = "guest" -> string -const RabbitMQ.Client.ConnectionFactory.DefaultRabbitMqMaxInboundMessageBodySize = 134217728 -> uint const RabbitMQ.Client.ConnectionFactory.DefaultUser = "guest" -> string const RabbitMQ.Client.ConnectionFactory.DefaultVHost = "/" -> string const RabbitMQ.Client.Constants.AccessRefused = 403 -> int @@ -884,7 +883,7 @@ virtual RabbitMQ.Client.TcpClientAdapter.ReceiveTimeout.set -> void ~const RabbitMQ.Client.RabbitMQActivitySource.PublisherSourceName = "RabbitMQ.Client.Publisher" -> string ~const RabbitMQ.Client.RabbitMQActivitySource.SubscriberSourceName = "RabbitMQ.Client.Subscriber" -> string ~override RabbitMQ.Client.Events.EventingBasicConsumer.HandleBasicDeliverAsync(string consumerTag, ulong deliveryTag, bool redelivered, string exchange, string routingKey, RabbitMQ.Client.ReadOnlyBasicProperties properties, System.ReadOnlyMemory body) -> System.Threading.Tasks.Task -~RabbitMQ.Client.AmqpTcpEndpoint.AmqpTcpEndpoint(string hostName, int portOrMinusOne, RabbitMQ.Client.SslOption ssl, uint rabbitMqMaxMessageSize) -> void +~RabbitMQ.Client.AmqpTcpEndpoint.AmqpTcpEndpoint(string hostName, int portOrMinusOne, RabbitMQ.Client.SslOption ssl, uint maxInboundMessageBodySize) -> void ~RabbitMQ.Client.ConnectionFactory.CreateConnectionAsync(RabbitMQ.Client.IEndpointResolver endpointResolver, string clientProvidedName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task ~RabbitMQ.Client.ConnectionFactory.CreateConnectionAsync(string clientProvidedName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task ~RabbitMQ.Client.ConnectionFactory.CreateConnectionAsync(System.Collections.Generic.IEnumerable endpoints, string clientProvidedName, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) -> System.Threading.Tasks.Task diff --git a/projects/RabbitMQ.Client/client/api/AmqpTcpEndpoint.cs b/projects/RabbitMQ.Client/client/api/AmqpTcpEndpoint.cs index 3ece10b1a8..0e8b5934a2 100644 --- a/projects/RabbitMQ.Client/client/api/AmqpTcpEndpoint.cs +++ b/projects/RabbitMQ.Client/client/api/AmqpTcpEndpoint.cs @@ -70,16 +70,15 @@ public class AmqpTcpEndpoint /// Hostname. /// Port number. If the port number is -1, the default port number will be used. /// Ssl option. - /// Maximum message size from RabbitMQ. . It defaults to - /// MaximumMaxMessageSize if the parameter is greater than MaximumMaxMessageSize. + /// Maximum message size from RabbitMQ. public AmqpTcpEndpoint(string hostName, int portOrMinusOne, SslOption ssl, - uint rabbitMqMaxMessageSize) + uint maxInboundMessageBodySize) { HostName = hostName; _port = portOrMinusOne; Ssl = ssl; - _maxInboundMessageBodySize = Math.Min(rabbitMqMaxMessageSize, - ConnectionFactory.DefaultRabbitMqMaxInboundMessageBodySize); + _maxInboundMessageBodySize = Math.Min(maxInboundMessageBodySize, + InternalConstants.DefaultRabbitMqMaxInboundMessageBodySize); } /// diff --git a/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs b/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs index dbb6650c2d..1ca5b9c408 100644 --- a/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs +++ b/projects/RabbitMQ.Client/client/api/ConnectionFactory.cs @@ -111,13 +111,6 @@ public sealed class ConnectionFactory : ConnectionFactoryBase, IConnectionFactor /// public const uint DefaultMaxInboundMessageBodySize = 1_048_576 * 64; - /// - /// Largest message size, in bytes, allowed in RabbitMQ. - /// Note: rabbit.max_message_size setting (https://www.rabbitmq.com/configure.html) - /// configures the largest message size which should be lower than this maximum of 128MiB. - /// - public const uint DefaultRabbitMqMaxInboundMessageBodySize = 1_048_576 * 128; - /// /// Default value for desired heartbeat interval. Default is 60 seconds, /// TimeSpan.Zero means "heartbeats are disabled". diff --git a/projects/RabbitMQ.Client/client/api/InternalConstants.cs b/projects/RabbitMQ.Client/client/api/InternalConstants.cs index 8ee85ae173..058d686389 100644 --- a/projects/RabbitMQ.Client/client/api/InternalConstants.cs +++ b/projects/RabbitMQ.Client/client/api/InternalConstants.cs @@ -37,5 +37,12 @@ internal static class InternalConstants { internal static readonly TimeSpan DefaultConnectionAbortTimeout = TimeSpan.FromSeconds(5); internal static readonly TimeSpan DefaultConnectionCloseTimeout = TimeSpan.FromSeconds(30); + + /// + /// Largest message size, in bytes, allowed in RabbitMQ. + /// Note: rabbit.max_message_size setting (https://www.rabbitmq.com/configure.html) + /// configures the largest message size which should be lower than this maximum of 128MiB. + /// + internal const uint DefaultRabbitMqMaxInboundMessageBodySize = 1_048_576 * 128; } } diff --git a/projects/Test/Integration/TestConnectionFactory.cs b/projects/Test/Integration/TestConnectionFactory.cs index 9a7ea9bbbe..8dfed9650c 100644 --- a/projects/Test/Integration/TestConnectionFactory.cs +++ b/projects/Test/Integration/TestConnectionFactory.cs @@ -339,8 +339,9 @@ public async Task TestCreateConnectionUsesValidEndpointWhenMultipleSupplied() [Fact] public void TestCreateAmqpTCPEndPointOverridesMaxMessageSizeWhenGreaterThanMaximumAllowed() { - _ = new AmqpTcpEndpoint("localhost", -1, new SslOption(), - ConnectionFactory.DefaultRabbitMqMaxInboundMessageBodySize); + var ep = new AmqpTcpEndpoint("localhost", -1, new SslOption(), + 2 * InternalConstants.DefaultRabbitMqMaxInboundMessageBodySize); + Assert.Equal(InternalConstants.DefaultRabbitMqMaxInboundMessageBodySize, ep.MaxInboundMessageBodySize); } [Fact]