Is there an existing issue for this?
Description
Since rabbitmq-client-dotnet 7.x the C# RabbitMQ client enforces a max message body size for incoming messages through the ConnectionFactory.MaxInboundMessageBodySize property. This is set to 64 MB per default.
See RabbitMQ-PR rabbitmq/rabbitmq-dotnet-client#1566
According to
|
Configure<AbpRabbitMqOptions>(configuration.GetSection("RabbitMQ")); |
... this property should be configurable through appsettings.json by setting the RabbitMQ:Connections:Default:MaxInboundMessageBodySize value:
{
"RabbitMQ": {
"Connections": {
"Default": {
"HostName": "123.123.123.123"
"Port": "5672",
"MaxInboundMessageBodySize": "500000000"
}
}
}
}
But when the ConnectionPool fetches the ConnectionFactory from dependency injection it contains the configured values for "HostName" and "Port" but still uses the default value for "MaxInboundMessageBodySize" of 67108864 (64 MB).
|
var connectionFactory = Options.Connections.GetOrDefault(connectionName); |
Reproduction Steps
Create or reusae any abp project that uses the Volo.Abp.EventBus.RabbitMq module:
- set the MaxInboundMessageBodySize property for the RabbitMq connection in
appsettings.json
{
"RabbitMQ": {
"Connections": {
"Default": {
"HostName": "123.123.123.123"
"Port": "5672",
"MaxInboundMessageBodySize": "500000000"
}
}
},
...
}
- Set a breakpoint in ConnectionPool.GetAsync() -
|
var connectionFactory = Options.Connections.GetOrDefault(connectionName); |
- Start the application
Expected behavior
-> When the breakpoint halts the connectionFactory object fetched from dependency injection should be configured with
MaxInboundMessageBodySize: 500000000
Actual behavior
-> When the breakpoint halts the connectionFactory object fetched from dependency injection is configured with
- ✅ HostName: "123.123.123.123"
- ✅ Port: 5672
- ❌ MaxInboundMessageBodySize: 67108864
Regression?
No response
Known Workarounds
Pass the configuration value RabbitMQ:Connections:Default:MaxInboundMessageBodySize into the AbpRabbitMqOptions object per code "manually":
Configure<AbpRabbitMqOptions>(options =>
{
var rabbitMqConnectionsSection = configuration.GetSection("RabbitMQ:Connections");
foreach (var connectionSection in rabbitMqConnectionsSection.GetChildren())
{
options.Connections[connectionSection.Key].MaxInboundMessageBodySize = connectionSection.GetValue<uint>(
"MaxInboundMessageBodySize",
ConnectionFactory.DefaultMaxInboundMessageBodySize
);
}
});
Version
10.4.1
User Interface
Common (Default)
Database Provider
EF Core (Default)
Tiered or separate authentication server
None (Default)
Operation System
Windows (Default)
Other information
No response
Is there an existing issue for this?
Description
Since rabbitmq-client-dotnet 7.x the C# RabbitMQ client enforces a max message body size for incoming messages through the ConnectionFactory.MaxInboundMessageBodySize property. This is set to 64 MB per default.
See RabbitMQ-PR rabbitmq/rabbitmq-dotnet-client#1566
According to
abp/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/AbpRabbitMqModule.cs
Line 18 in b86ef96
... this property should be configurable through appsettings.json by setting the
RabbitMQ:Connections:Default:MaxInboundMessageBodySizevalue:{ "RabbitMQ": { "Connections": { "Default": { "HostName": "123.123.123.123" "Port": "5672", "MaxInboundMessageBodySize": "500000000" } } } }But when the ConnectionPool fetches the ConnectionFactory from dependency injection it contains the configured values for "HostName" and "Port" but still uses the default value for "MaxInboundMessageBodySize" of 67108864 (64 MB).
abp/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ConnectionPool.cs
Line 44 in b86ef96
Reproduction Steps
Create or reusae any abp project that uses the Volo.Abp.EventBus.RabbitMq module:
appsettings.json
{ "RabbitMQ": { "Connections": { "Default": { "HostName": "123.123.123.123" "Port": "5672", "MaxInboundMessageBodySize": "500000000" } } }, ... }abp/framework/src/Volo.Abp.RabbitMQ/Volo/Abp/RabbitMQ/ConnectionPool.cs
Line 44 in b86ef96
Expected behavior
-> When the breakpoint halts the connectionFactory object fetched from dependency injection should be configured with
MaxInboundMessageBodySize: 500000000
Actual behavior
-> When the breakpoint halts the connectionFactory object fetched from dependency injection is configured with
Regression?
No response
Known Workarounds
Pass the configuration value
RabbitMQ:Connections:Default:MaxInboundMessageBodySizeinto the AbpRabbitMqOptions object per code "manually":Version
10.4.1
User Interface
Common (Default)
Database Provider
EF Core (Default)
Tiered or separate authentication server
None (Default)
Operation System
Windows (Default)
Other information
No response