lordgamez commented on code in PR #1849:
URL: https://github.com/apache/nifi-minifi-cpp/pull/1849#discussion_r1701600735


##########
docker/test/integration/features/python.feature:
##########
@@ -143,3 +143,17 @@ Feature: MiNiFi can use python processors in its flows
     When all instances start up
 
     Then one flowfile with the contents "Check successful!" is placed in the 
monitored directory in less than 30 seconds
+
+  @USE_NIFI_PYTHON_PROCESSORS
+  Scenario: A MiNiFi instance can update attributes through native python 
processor
+    Given a GenerateFlowFile processor with the "File Size" property set to 
"0B"
+    And a FailureWithAttributes processor

Review Comment:
   Good point, actually there was a bug in there because in NiFi the python API 
uses `addAttribute` and we used the same, but in NiFi it updates the attribute 
if it exists, but MiNiFi C++ doesn't, we have to use `setAttribute` instead. 
Updated in 30268333d5fff6c48822cb54925b8189ff6d0e49



##########
extensions/python/pythonprocessors/nifiapi/flowfiletransform.py:
##########
@@ -98,12 +98,15 @@ def onTrigger(self, context: ProcessContext, session: 
ProcessSession):
             session.transfer(original_flow_file, self.REL_FAILURE)
             return
 
+        result_attributes = result.getAttributes()
         if result.getRelationship() == "failure":
             session.remove(flow_file)
+            if result_attributes is not None:
+                for attribute in result_attributes:
+                    original_flow_file.addAttribute(attribute, 
result_attributes[attribute])

Review Comment:
   Updated in 30268333d5fff6c48822cb54925b8189ff6d0e49



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