rabbitmq / rabbitmq-dotnet-client

RabbitMQ .NET client for .NET Standard 2.0+ and .NET 4.6.2+
https://www.rabbitmq.com/dotnet.html
Other
2.07k stars 579 forks source link

Configured `MaxMessageSize` is not honoured #1378

Closed MarcialRosales closed 1 year ago

MarcialRosales commented 1 year ago

Describe the bug

Despite configuring ConnectionFactory.MaxMessageSize, this limit is not applied and instead the .Net client uses the default limit set in ConnectionFactory.DefaultMaxMessageSize (=134217728).

This does not happen in 6.x versions. The reason is because when the ConnectionFactory creates AmqpTcpEndpoint, it uses a constructor which does not take in the parameter maxMessageSize hence it defaults it to ConnectionFactory.DefaultMaxMessageSize. In 6.x, the default value was 0, i.e. unlimited.

Reproduction steps

  1. Configure ConnectionFactory.DefaultMaxMessageSize to 500Mb
  2. Send messages of 500Mb to a queue
  3. Consume messages from that queue
  4. The consumer fails with every single message because all of them are greater than 134217728 ...

Expected behavior

All messages should be consumed because they are equal to the configured MaxMessageSize.

Additional context

No response

lukebakken commented 1 year ago

Double-check that we're not hitting the RabbitMQ limit. I forget what the max size is by default.

lukebakken commented 1 year ago

@MarcialRosales @michaelklishin I will back-port this to the 6.x branch.