tpalfy commented on code in PR #11499:
URL: https://github.com/apache/nifi/pull/11499#discussion_r4095389547


##########
nifi-extension-bundles/nifi-protobuf-bundle/nifi-protobuf-services/src/main/java/org/apache/nifi/services/protobuf/WriteProtobufResultWithExternalSchema.java:
##########
@@ -0,0 +1,141 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.nifi.services.protobuf;
+
+import com.squareup.wire.schema.Schema;
+import org.apache.nifi.schemaregistry.services.MessageIndexWriter;
+import org.apache.nifi.schemaregistry.services.MessageName;
+import org.apache.nifi.schemaregistry.services.SchemaDefinition;
+import org.apache.nifi.schemaregistry.services.SchemaReferenceWriter;
+import org.apache.nifi.serialization.AbstractRecordSetWriter;
+import org.apache.nifi.serialization.record.Record;
+import org.apache.nifi.serialization.record.RecordSchema;
+import org.apache.nifi.services.protobuf.converter.ProtobufDataSerializer;
+
+import java.io.BufferedOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.Map;
+
+/**
+ * Writes Records as Protocol Buffers binary content. When a {@link 
SchemaReferenceWriter} is
+ * configured, a Confluent wire-format header (magic byte and schema 
identifier) is written first;
+ * when a {@link MessageIndexWriter} is configured, the Confluent message 
index array follows the
+ * header. The serialized Protobuf payload is written last.
+ * <p>
+ * The Confluent framing (header and message index) is written once at the 
beginning of the record
+ * set, mirroring {@code WriteAvroResultWithExternalSchema}; the typical 
Confluent use case writes a
+ * single message per FlowFile.
+ */

Review Comment:
   Avoid Confluent-specific details.
   
   ```suggestion
   /**
    * Writes a single Record as Protocol Buffers binary content. When 
configured, the
    * Schema Reference Writer and Message Index Writer write format-specific 
information
    * before the Protobuf payload, in that order.
    * <p>
    * Only one Record can be written because raw Protocol Buffers messages do 
not contain
    * boundaries that allow concatenated messages to be decoded independently.
    */
   ```



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