Skip to content

Commit

Permalink
Merge pull request #352 from malakaganga/fix_maxinb
Browse files Browse the repository at this point in the history
Add RabbitMq maxInboundMessageBodySize
  • Loading branch information
malakaganga authored Dec 11, 2024
2 parents 6bc1900 + 84a7fb3 commit ddef499
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ private ConnectionFactory loadConnectionFactory(Map<String, String> parameters)
BooleanUtils.toBoolean(parameters.get(RabbitMQConstants.SSL_ENABLED)), false);
boolean externalAuthEnabled = BooleanUtils.toBooleanDefaultIfNull(
BooleanUtils.toBoolean(parameters.get(RabbitMQConstants.EXTERNAL_AUTH_MECHANISM)), false);
String maxInboundMessageSize = parameters.get(RabbitMQConstants.MAX_INBOUND_MESSAGE_BODY_SIZE);

String[] hostnameArray = hostnames.split(",");
String[] portArray = ports.split(",");
Expand All @@ -239,6 +240,10 @@ private ConnectionFactory loadConnectionFactory(Map<String, String> parameters)
connectionFactory.setNetworkRecoveryInterval(networkRecoveryInterval);
connectionFactory.setAutomaticRecoveryEnabled(true);
connectionFactory.setTopologyRecoveryEnabled(true);
if (StringUtils.isNotEmpty(maxInboundMessageSize)) {
int maxInboundMessageSizeInt = NumberUtils.toInt(maxInboundMessageSize);
connectionFactory.setMaxInboundMessageBodySize(maxInboundMessageSizeInt);
}
if (externalAuthEnabled) {
connectionFactory.setSaslConfig(DefaultSaslConfig.EXTERNAL);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ public class RabbitMQConstants {
public static final String NETWORK_RECOVERY_INTERVAL = "rabbitmq.connection.factory.network.recovery.interval";
public static final String RETRY_INTERVAL = "rabbitmq.connection.retry.interval";
public static final String RETRY_COUNT = "rabbitmq.connection.retry.count";
public static final String MAX_INBOUND_MESSAGE_BODY_SIZE = "rabbitmq.max.inbound.message.body.size";

public static final String CORRELATION_ID = "rabbitmq.message.correlation.id";
public static final String MESSAGE_ID = "rabbitmq.message.id";
Expand Down

0 comments on commit ddef499

Please sign in to comment.