umarhussain15 commented on code in PR #8105:
URL: https://github.com/apache/nifi/pull/8105#discussion_r1437011582


##########
nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/ConsumeAMQP.java:
##########
@@ -191,6 +204,19 @@ public class ConsumeAMQP extends 
AbstractAMQPProcessor<AMQPConsumer> {
         objectMapper = new ObjectMapper();
     }
 
+    @OnScheduled
+    public void onScheduled(ProcessContext context) {
+        super.onScheduled(context);
+        batchSize = context.getProperty(BATCH_SIZE).asInteger();
+        queueName = context.getProperty(QUEUE).getValue();
+        headerFormat = context.getProperty(HEADER_FORMAT).getValue();
+        headerAttributePrefix = 
context.getProperty(HEADER_KEY_PREFIX).getValue();
+        removeCurlyBraces=context.getProperty(REMOVE_CURLY_BRACES).asBoolean();
+        valueSeparatorForHeaders = 
context.getProperty(HEADER_SEPARATOR).getValue();
+        autoAcknowledge = context.getProperty(AUTO_ACKNOWLEDGE).asBoolean();
+        prefetchCount =  context.getProperty(PREFETCH_COUNT).asInteger();

Review Comment:
   I moved these to class level variables since they are only evaluated when 
processor is scheduled and will not change during `onTrigger`. Most of them 
don't have `ExpressionLanguageScope.FLOWFILE_ATTRIBUTES` or only have 
`ExpressionLanguageScope.ENVIRONMENT`.
   But I can move them back to be method local, if they don't provide any 
benefit performance wise.



-- 
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: issues-unsubscr...@nifi.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to