You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@nifi.apache.org by GitBox <gi...@apache.org> on 2022/10/10 18:20:07 UTC

[GitHub] [nifi] exceptionfactory commented on a diff in pull request #6131: NIFI-9822 - ConsumeKafkaRecord allows writing out Kafka record key

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


##########
nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-2-6-processors/src/main/java/org/apache/nifi/processors/kafka/pubsub/PublisherLease.java:
##########
@@ -188,18 +202,30 @@ void publish(final FlowFile flowFile, final RecordSet recordSet, final RecordSet
                 baos.reset();
 
                 Map<String, String> additionalAttributes = Collections.emptyMap();
-                try (final RecordSetWriter writer = writerFactory.createWriter(logger, schema, baos, flowFile)) {
-                    final WriteResult writeResult = writer.write(record);
-                    additionalAttributes = writeResult.getAttributes();
-                    writer.flush();
+                final List<Header> headers;
+                final byte[] messageContent;
+                final byte[] messageKey;
+                if (PublishStrategy.USE_WRAPPER.equals(publishStrategy)) {
+                    headers = toHeadersWrapper(record.getValue("headers"));
+                    final Object key = record.getValue("key");
+                    final Object value = record.getValue("value");
+                    logger.trace("Key: {}", key);
+                    logger.trace("Value: {}", value);

Review Comment:
   Recommend removing these trace logs from the final version.



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