rzepinskip commented on code in PR #11899:
URL: https://github.com/apache/nifi/pull/11899#discussion_r4523674138
##########
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(), false);
+ value.getFirstOffset(), key.getTimestamp(), key.getHeaders(),
key.getMessageKey(), data, value.getCount(), tombstone);
Review Comment:
Alternative is to skip this code change and have change in behavior (bundles
with empty / null tombstone only would result in empty flow file **without**
tombstone attribute set).
Proper support for DEMARCATOR is left for separate ticket:
https://issues.apache.org/jira/browse/NIFI-16521
--
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]