You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by "mark-bathori (via GitHub)" <gi...@apache.org> on 2025/11/18 10:55:20 UTC

[PR] NIFI-14443: Add FlowFile Expression Language support for Hostname and Share properties in PutSMBFile [nifi]

mark-bathori opened a new pull request, #10541:
URL: https://github.com/apache/nifi/pull/10541

   The proposed solution uses a FlowFile filter designed to avoid possible performance degradation by grouping FlowFiles that share the same **hostname** and **share** values. This grouping is combined with the already existing batch size property. While these changes may alter the order of FlowFiles when the processor is used with different **hostname** and **share** values, I believe this change will not significantly impact the SMB processor, given that the original behavior is retained.
   
   <!-- Licensed to the Apache Software Foundation (ASF) under one or more -->
   <!-- contributor license agreements.  See the NOTICE file distributed with -->
   <!-- this work for additional information regarding copyright ownership. -->
   <!-- The ASF licenses this file to You under the Apache License, Version 2.0 -->
   <!-- (the "License"); you may not use this file except in compliance with -->
   <!-- the License.  You may obtain a copy of the License at -->
   <!--     http://www.apache.org/licenses/LICENSE-2.0 -->
   <!-- Unless required by applicable law or agreed to in writing, software -->
   <!-- distributed under the License is distributed on an "AS IS" BASIS, -->
   <!-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -->
   <!-- See the License for the specific language governing permissions and -->
   <!-- limitations under the License. -->
   
   # Summary
   
   [NIFI-14443](https://issues.apache.org/jira/browse/NIFI-14443)
   
   # Tracking
   
   Please complete the following tracking steps prior to pull request creation.
   
   ### Issue Tracking
   
   - [x] [Apache NiFi Jira](https://issues.apache.org/jira/browse/NIFI) issue created
   
   ### Pull Request Tracking
   
   - [x] Pull Request title starts with Apache NiFi Jira issue number, such as `NIFI-00000`
   - [x] Pull Request commit message starts with Apache NiFi Jira issue number, as such `NIFI-00000`
   
   ### Pull Request Formatting
   
   - [x] Pull Request based on current revision of the `main` branch
   - [x] Pull Request refers to a feature branch with one commit containing changes
   
   # Verification
   
   Please indicate the verification steps performed prior to pull request creation.
   
   ### Build
   
   - [x] Build completed using `./mvnw clean install -P contrib-check`
     - [x] JDK 21
     - [ ] JDK 25
   
   ### Licensing
   
   - [ ] New dependencies are compatible with the [Apache License 2.0](https://apache.org/licenses/LICENSE-2.0) according to the [License Policy](https://www.apache.org/legal/resolved.html)
   - [ ] New dependencies are documented in applicable `LICENSE` and `NOTICE` files
   
   ### Documentation
   
   - [ ] Documentation formatting appears as expected in rendered files
   


-- 
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-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-14443: Add FlowFile Expression Language support for Hostname and Share properties in PutSMBFile [nifi]

Posted by "asf-gitbox-commits (via GitHub)" <gi...@apache.org>.
asf-gitbox-commits closed pull request #10541: NIFI-14443: Add FlowFile Expression Language support for Hostname and Share properties in PutSMBFile
URL: https://github.com/apache/nifi/pull/10541


-- 
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-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-14443: Add FlowFile Expression Language support for Hostname and Share properties in PutSMBFile [nifi]

Posted by "exceptionfactory (via GitHub)" <gi...@apache.org>.
exceptionfactory commented on code in PR #10541:
URL: https://github.com/apache/nifi/pull/10541#discussion_r2553322791


##########
nifi-extension-bundles/nifi-smb-bundle/nifi-smb-processors/src/main/java/org/apache/nifi/processors/smb/PutSmbFile.java:
##########
@@ -285,15 +288,17 @@ private void createMissingDirectoriesRecursevly(ComponentLog logger, DiskShare s
     @Override
     public void onTrigger(final ProcessContext context, final ProcessSession session) throws ProcessException {
         final int batchSize = context.getProperty(BATCH_SIZE).asInteger();
-        List<FlowFile> flowFiles = session.get(batchSize);
+        final HostnameAndShareFlowFileFilter fileFilter = new HostnameAndShareFlowFileFilter(context, batchSize);
+        final List<FlowFile> flowFiles = session.get(fileFilter);
         if ( flowFiles.isEmpty() ) {
             return;
         }
         final ComponentLog logger = getLogger();
         logger.debug("Processing next {} flowfiles", flowFiles.size());
 
-        final String hostname = context.getProperty(HOSTNAME).getValue();
-        final String shareName = context.getProperty(SHARE).getValue();
+        final FlowFile firstFlowFile = flowFiles.getFirst();
+        final String hostname = context.getProperty(HOSTNAME).evaluateAttributeExpressions(firstFlowFile).getValue();
+        final String shareName = context.getProperty(SHARE).evaluateAttributeExpressions(firstFlowFile).getValue();

Review Comment:
   Instead of evaluating against the first FlowFile, I recommend adding get methods on the `FlowFileFilter`.



-- 
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-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-14443: Add FlowFile Expression Language support for Hostname and Share properties in PutSMBFile [nifi]

Posted by "turcsanyip (via GitHub)" <gi...@apache.org>.
turcsanyip commented on PR #10541:
URL: https://github.com/apache/nifi/pull/10541#issuecomment-3547020208

   @mark-bathori Thanks for the improvement. At first glance, it looks good overall. Will test it later.
   I think some unit tests would be useful for the new `FlowFileFilter` and a `TestRunner` test could also be added in `PutSmbFileTest` for this new use case.
   Thanks


-- 
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-unsubscribe@nifi.apache.org

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


Re: [PR] NIFI-14443: Add FlowFile Expression Language support for Hostname and Share properties in PutSMBFile [nifi]

Posted by "mark-bathori (via GitHub)" <gi...@apache.org>.
mark-bathori commented on PR #10541:
URL: https://github.com/apache/nifi/pull/10541#issuecomment-3570817827

   Thanks, @turcsanyip and @exceptionfactory, for the review. I've updated the PR according to your comments.


-- 
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-unsubscribe@nifi.apache.org

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