pvillard31 commented on code in PR #9776:
URL: https://github.com/apache/nifi/pull/9776#discussion_r1982937355
##########
nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AbstractAMQPProcessor.java:
##########
@@ -303,7 +311,8 @@ protected Connection createConnection(ProcessContext
context, ExecutorService ex
final ConnectionFactory cf = new ConnectionFactory();
cf.setUsername(context.getProperty(USER).evaluateAttributeExpressions().getValue());
cf.setPassword(context.getProperty(PASSWORD).getValue());
-
+
cf.setMaxInboundMessageBodySize(Integer.parseInt(context.getProperty(MAX_INBOUND_MESSAGE_BODY_SIZE).evaluateAttributeExpressions().getValue()));
+
Review Comment:
```suggestion
cf.setMaxInboundMessageBodySize(context.getProperty(MAX_INBOUND_MESSAGE_BODY_SIZE).evaluateAttributeExpressions().asDataSize(DataUnit.B).intValue());
```
##########
nifi-extension-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/AbstractAMQPProcessor.java:
##########
@@ -138,7 +138,14 @@ abstract class AbstractAMQPProcessor<T extends AMQPWorker>
extends AbstractProce
.allowableValues("true", "false")
.addValidator(StandardValidators.BOOLEAN_VALIDATOR)
.build();
-
+ public static final PropertyDescriptor MAX_INBOUND_MESSAGE_BODY_SIZE = new
PropertyDescriptor.Builder()
+ .name("MaxInboundMessageBodySize")
+ .description("Maximum body size of inbound (received) messages in
bytes.")
+ .required(false)
+ .defaultValue("67108864")
+ .expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
+ .addValidator(StandardValidators.NON_EMPTY_VALIDATOR)
+ .build();
Review Comment:
Recommend using built-in data size validator:
```suggestion
public static final PropertyDescriptor MAX_INBOUND_MESSAGE_BODY_SIZE =
new PropertyDescriptor.Builder()
.name("Max Inbound Message Body Size")
.description("Maximum body size of inbound (received) messages.")
.required(true)
.defaultValue("64 MB")
.expressionLanguageSupported(ExpressionLanguageScope.ENVIRONMENT)
.addValidator(StandardValidators.DATA_SIZE_VALIDATOR)
.build();
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]