jrsteinebrey commented on code in PR #8584:
URL: https://github.com/apache/nifi/pull/8584#discussion_r1659488574


##########
nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/PublishJMS.java:
##########
@@ -211,8 +212,12 @@ public class PublishJMS extends 
AbstractJMSProcessor<JMSPublisher> {
      */
     @Override
     protected void rendezvousWithJms(ProcessContext context, ProcessSession 
processSession, JMSPublisher publisher) throws ProcessException {
-        FlowFile flowFile = processSession.get();
-        if (flowFile != null) {
+        final List<FlowFile> flowFiles = 
processSession.get(context.getProperty(MAX_BATCH_SIZE).asInteger());
+        if (flowFiles.isEmpty()) {
+            return;
+        }
+
+        flowFiles.forEach(flowFile -> {

Review Comment:
   @mosermw Thanks for these enhancements to JMS consume and publish. 
   Please review the existing code inside the new added loop and look for ways 
to optimize it. 
   For example, move these variables to be created once before the loop if 
possible:
     allowIllegalChars
     attributeHeaderRegex 
     pattern
     readerFactory
     writerFactory
     flowFileReader



##########
nifi-extension-bundles/nifi-jms-bundle/nifi-jms-processors/src/main/java/org/apache/nifi/jms/processors/AbstractJMSProcessor.java:
##########
@@ -128,6 +128,14 @@ public abstract class AbstractJMSProcessor<T extends 
JMSWorker> extends Abstract
             
.identifiesControllerService(JMSConnectionFactoryProviderDefinition.class)
             .build();
 
+    static final PropertyDescriptor MAX_BATCH_SIZE = new 
PropertyDescriptor.Builder()
+            .name("Maximum Batch Size")
+            .description("The number of messages to publish or consume in a 
single iteration of the processor.")

Review Comment:
   Thanks for making batch size consistent in these processors.
   NiFi does not have for loops in the ui so I suggest using "invocation" 
instead of "iteration" if you don't mind.



-- 
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]

Reply via email to