rzepinskip commented on code in PR #11860:
URL: https://github.com/apache/nifi/pull/11860#discussion_r4398330616


##########
nifi-extension-bundles/nifi-kafka-bundle/nifi-kafka-processors/src/main/java/org/apache/nifi/kafka/processors/consumer/bundle/ByteRecordBundler.java:
##########
@@ -65,8 +65,11 @@ private ByteRecord toByteRecord(final BundleKey key, final 
BundleValue value) {
         final TopicPartitionSummary topicPartition = key.getTopicPartition();
         key.headers.add(new 
RecordHeader(KafkaFlowFileAttribute.KAFKA_MAX_OFFSET, 
Long.toString(value.getLastOffset()).getBytes(StandardCharsets.UTF_8)));
         key.headers.add(new RecordHeader(KafkaFlowFileAttribute.KAFKA_COUNT, 
Long.toString(value.getCount()).getBytes(StandardCharsets.UTF_8)));
+        final byte[] data = value.getData();
+        // Demarcator emits one FlowFile per bundle, so an empty bundle is 
still reported as a tombstone.
+        final boolean tombstone = data.length == 0;
         return new ByteRecord(topicPartition.getTopic(), 
topicPartition.getPartition(),
-                value.getFirstOffset(), key.getTimestamp(), key.getHeaders(), 
key.getMessageKey(), value.getData(), value.getCount());
+                value.getFirstOffset(), key.getTimestamp(), key.getHeaders(), 
key.getMessageKey(), data, value.getCount(), tombstone);

Review Comment:
   Keeping current behavior unchanged for DEMARCATOR strategy



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