dan-s1 commented on code in PR #9785:
URL: https://github.com/apache/nifi/pull/9785#discussion_r2007827509
##########
nifi-extension-bundles/nifi-jolt-bundle/nifi-jolt-processors/src/main/java/org/apache/nifi/processors/jolt/JoltTransformJSON.java:
##########
@@ -152,13 +193,18 @@ public void onTrigger(final ProcessContext context,
ProcessSession session) thro
}
}
- FlowFile transformed = session.write(original, out ->
out.write(jsonString.getBytes(StandardCharsets.UTF_8)));
-
- final String transformType =
context.getProperty(JOLT_TRANSFORM).getValue();
- transformed = session.putAttribute(transformed,
CoreAttributes.MIME_TYPE.key(), "application/json");
- session.transfer(transformed, REL_SUCCESS);
- session.getProvenanceReporter().modifyContent(transformed, "Modified
With " + transformType, stopWatch.getElapsed(TimeUnit.MILLISECONDS));
- logger.info("Transform completed for {}", original);
+ if (sourceStrategyFlowFile) {
+ FlowFile transformed = session.write(original, out ->
out.write(jsonString.getBytes(StandardCharsets.UTF_8)));
+ final String transformType =
context.getProperty(JOLT_TRANSFORM).getValue();
+ transformed = session.putAttribute(transformed,
CoreAttributes.MIME_TYPE.key(), "application/json");
+ session.transfer(transformed, REL_SUCCESS);
+ session.getProvenanceReporter().modifyContent(transformed,
"Modified With " + transformType, stopWatch.getElapsed(TimeUnit.MILLISECONDS));
+ logger.info("Transform completed on FlowFile content for {}",
original);
+ } else {
+ session.putAttribute(original, jsonSourceAttributeName,
jsonString);
+ session.transfer(original, REL_SUCCESS);
+ logger.info("Transform completed on FlowFile attribute for {}",
original);
+ }
Review Comment:
Again, it may be beneficial to name the attribute which was transformed so
it is clear in the logs
```suggestion
logger.info("Transform completed of attribute {} on FlowFile
{}", sonSourceAttributeName, original);
}
```
--
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]