NIFI-14210 Add record writer for Protobuf messages - #11499
Open
prankstrisse wants to merge 1 commit into
Open
Conversation
prankstrisse
force-pushed
the
NIFI-14210
branch
3 times, most recently
from
August 3, 2026 12:05
2bf36d3 to
936d100
Compare
prankstrisse
force-pushed
the
NIFI-14210
branch
from
August 3, 2026 12:13
936d100 to
3caa6e9
Compare
prankstrisse
marked this pull request as ready for review
August 3, 2026 14:53
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
NIFI-14210
Changes
StandardProtobufWriter(nifi-protobuf-services) — newSchemaRegistryService+RecordSetWriterFactory. Resolves the target Proto message either statically via aMessage Nameproperty or dynamically via aMessageNameResolverservice, compiles the schema with the existingProtobufSchemaCompiler, and serializes each Record with a newProtobufDataSerializer. A single message is written per FlowFile, since concatenated Protobuf messages cannot be delimited on read.ProtobufDataSerializer— maps NiFi Record fields onto WireSchema/MessageTypedescriptors and encodes the binary payload.google.protobuf.Any-typed fields are written as plain nested messages rather than re-wrapped asAny.WriteProtobufResultWithExternalSchema— orchestrates header + message-index + payload sequencing, mirroring the existingWriteAvroResultWithExternalSchemapattern: invokesSchemaReferenceWriter.writeHeader(...)when a Schema Reference Writer is configured, then an optionalMessageIndexWriter.writeMessageIndex(...)step, then the Protobuf payload.MessageIndexWriter(nifi-schema-registry-service-api) — new shared interface, the write-side inverse ofMessageNameResolver: given a resolved message name and schema definition, encodes the path to that message and writes it to the output stream so a reader can resolve the same name back from the encoded path.ConfluentProtobufMessageIndexWriter+ProtobufMessageIndexEncoder(nifi-confluent-protobuf-message-index-writer, new module) — Confluent implementation ofMessageIndexWriter. Walks nested message declarations to find the target message's declaration-order path and zigzag-varint encodes it (including the[0]single-message optimization), mirroring the decoding done byConfluentProtobufMessageNameResolver. Together with the unchanged, already-genericConfluentEncodedSchemaReferenceWriter, this reproduces the Confluent wire format (5-byte header + message-index array + payload) on write.VarintUtils— relocated from the message-name-resolver module toorg.apache.nifi.confluent.schemaand made non-package-privateso it can be shared between the resolver (read) and index writer (write) modules.ProtobufSchemaCompilerandProtobufSchemaValidatorto support reuse from the writer.Testing
ProtobufMessageIndexEncoderTest,ConfluentProtobufMessageIndexWriterTest— unit tests for index-path encoding, including nested messages and the single-index optimization.TestProtobufDataSerializer— Record-to-Protobuf field mapping and encoding.TestStandardProtobufWriter— controller service property/validation behavior.TestStandardProtobufWriterConfluentRoundTrip— end-to-end round trip:StandardProtobufWriteroutput (header + index + payload) is read back byStandardProtobufReader/ConfluentProtobufMessageNameResolverand compared against the original Records.Tracking
Please complete the following tracking steps prior to pull request creation.
Issue Tracking
Pull Request Tracking
NIFI-00000NIFI-00000VerifiedstatusPull Request Formatting
mainbranchVerification
Please indicate the verification steps performed prior to pull request creation.
Build
./mvnw clean install -P contrib-checkLicensing
LICENSEandNOTICEfilesDocumentation