Skip to content

Commit 128aca5

Browse files
authored
Add configuration for max inbound message size (#212)
* Add configuration for max inbound message size; set default to 512MB --------- Co-authored-by: Daniel Slunečko <[email protected]>
1 parent bf2c2b0 commit 128aca5

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

core/src/main/scala/com/avast/clients/rabbitmq/RabbitMQConnection.scala

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -216,6 +216,7 @@ object RabbitMQConnection {
216216
}
217217

218218
factory.setConnectionTimeout(connectionTimeout.toMillis.toInt)
219+
factory.setMaxInboundMessageBodySize(connectionConfig.maxInboundMessageBodySize)
219220
}
220221

221222
// scalastyle:off

core/src/main/scala/com/avast/clients/rabbitmq/configuration.scala

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,10 @@ final case class RabbitMQConnectionConfig(name: String,
1919
networkRecovery: NetworkRecoveryConfig = NetworkRecoveryConfig(),
2020
channelMax: Int = 2047,
2121
credentials: CredentialsConfig,
22-
republishStrategy: RepublishStrategyConfig = RepublishStrategyConfig.DefaultExchange)
22+
republishStrategy: RepublishStrategyConfig = RepublishStrategyConfig.DefaultExchange,
23+
// This is the new hard-limit on server side. see:
24+
// https://github.com/rabbitmq/rabbitmq-common/blob/67c4397ffa9f51d87f994aa4db4a68e8e95326ab/include/rabbit.hrl#L250
25+
maxInboundMessageBodySize: Int = 536870912)
2326

2427
final case class NetworkRecoveryConfig(enabled: Boolean = true, handler: RecoveryDelayHandler = RecoveryDelayHandlers.Linear())
2528

0 commit comments

Comments
 (0)