Github user MikeThomsen commented on a diff in the pull request:

    https://github.com/apache/nifi/pull/2292#discussion_r153658187
  
    --- Diff: 
nifi-nar-bundles/nifi-kafka-bundle/nifi-kafka-0-10-processors/src/main/java/org/apache/nifi/processors/kafka/pubsub/PublisherLease.java
 ---
    @@ -106,13 +106,15 @@ void publish(final FlowFile flowFile, final RecordSet 
recordSet, final RecordSet
             Record record;
             int recordCount = 0;
     
    -        try (final RecordSetWriter writer = 
writerFactory.createWriter(logger, schema, baos)) {
    +        try {
                 while ((record = recordSet.next()) != null) {
                     recordCount++;
                     baos.reset();
     
    -                writer.write(record);
    -                writer.flush();
    +                try (final RecordSetWriter writer = 
writerFactory.createWriter(logger, schema, baos)) {
    --- End diff --
    
    I think this is the right way to go because the Avro API only writes the 
schema once per Avro writer (AFAIK). 


---

Reply via email to