Repository navigation
[Java] Add multiplexed Avro streams - #1198
Draft
dimitrije-djordjevic-db wants to merge 1 commit into
Draft
dimitrije-djordjevic-db wants to merge 1 commit into
dimitrije-djordjevic-db wants to merge 1 commit into
Conversation
This was referenced Nov 23, 2026
dimitrije-djordjevic-db
force-pushed
the
effort/mux-streams-jni
branch
from
November 24, 2026 14:39
afc1393 to
9707bca
Compare
dimitrije-djordjevic-db
force-pushed
the
effort/mux-streams-jni-avro
branch
from
November 24, 2026 14:39
d0cf64b to
ea4e93b
Compare
Add multiplexed(streamCount) to the avro(...) sub-builder, building a ZerobusMultiplexedAvroStream (Beta) that ingests GenericRecords or pre-encoded Avro datums across sub-streams. Multiplexed streams are thread-safe, so the Avro encoder must be too. AvroEncoder.threadSafe() encodes each call into its own buffer, and its schema-match cache is a concurrent map; ordinary Avro streams keep the single-threaded encoder that reuses one buffer. Co-authored-by: Isaac <no-reply@databricks.com> Signed-off-by: Dimitrije Đorđević <dimitrije.djordjevic@databricks.com>
dimitrije-djordjevic-db
force-pushed
the
effort/mux-streams-jni
branch
from
November 27, 2026 13:10
9707bca to
6097463
Compare
dimitrije-djordjevic-db
force-pushed
the
effort/mux-streams-jni-avro
branch
from
November 27, 2026 13:11
ea4e93b to
9406609
Compare
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.
Stack
What changes are proposed in this pull request?
Adds multiplexed Avro streams (Beta):
multiplexed(streamCount)on theavro(...)sub-builder builds aZerobusMultiplexedAvroStream. It ingestsGenericRecords or pre-encoded Avro datums across sub-streams.AvroEncoder.threadSafe()encodes each call into its own buffer, and its schema-match cache is a concurrent map. Ordinary Avro streams keep the single-threaded encoder that reuses one buffer.NEXT_CHANGELOG.mdnow list Avro next to JSON and Protocol Buffers. The README adds that an Avro record that cannot be encoded fails only its own call withNonRetriableExceptionand sends nothing; the stream stays usable.Why: with this PR, Java multiplexed streams support JSON, Protocol Buffers and Avro. Arrow multiplexed streams are not part of this stack.
Closes #1115.
How is this tested?
MultiplexedStreamNativeTestadds Avro cases against the in-process mock server, including several threads that ingest Avro records into one stream; the test checks that every record arrives intact.AvroEncoderTestcases check that the thread-safe encoder writes the same bytes as the ordinary one, and that it accepts records from many equal schema instances.StreamBuilderTestadds Avro cases:multiplexed(n)rejects an out-of-range stream count, and the Avro build reaches the multiplexed native create.IntegrationTestruns a multiplexed Avro stream against a real Zerobus endpoint.mvn test: 200 run, 0 failed, 34 skipped (env-gated integration tests). The env-gated multiplexed protobuf and Avro cases passed 2/2 against a real Zerobus endpoint.This pull request and its description were written by Isaac.