exceptionfactory commented on code in PR #7652:
URL: https://github.com/apache/nifi/pull/7652#discussion_r1348157253


##########
nifi-nar-bundles/nifi-amqp-bundle/nifi-amqp-processors/src/main/java/org/apache/nifi/amqp/processors/ConsumeAMQP.java:
##########
@@ -214,14 +264,23 @@ private void addAttribute(final Map<String, String> 
attributes, final String att
         attributes.put(attributeName, value.toString());
     }
 
-    private String buildHeaders(Map<String, Object> headers,  boolean 
removeCurlyBraces, String valueSeparatorForHeaders) {
+    private String buildHeaders(Map<String, Object> headers, AllowableValue 
headerFormat, boolean removeCurlyBraces, String valueSeparatorForHeaders) {
         if (headers == null) {
             return null;
         }
-        String headerString = 
convertMapToString(headers,valueSeparatorForHeaders);
+        String headerString = null;
+        if (headerFormat.equals(HEADERS_FORMAT_COMMA_SEPARATED_STRING)) {
+            headerString = convertMapToString(headers, 
valueSeparatorForHeaders);
 
-        if (!removeCurlyBraces) {
-            headerString = "{" + headerString + "}";
+            if (!removeCurlyBraces) {
+                headerString = "{" + headerString + "}";
+            }
+        } else if (headerFormat.equals(HEADERS_FORMAT_JSON_STRING)) {
+            try {
+                headerString = convertMapToJSONString(headers);
+            } catch (JsonProcessingException e) {
+                getLogger().debug("error creating json string", e);

Review Comment:
   It seems like this should be logged as a warning instead of debug.
   ```suggestion
                   getLogger().warn("Header formatting as JSON failed", e);
   ```



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