Skip to content

[feat] PIP-466: Add V5 client API for scalable topics#25489

Merged
merlimat merged 11 commits intoapache:masterfrom
merlimat:st-v5-api
Apr 20, 2026
Merged

[feat] PIP-466: Add V5 client API for scalable topics#25489
merlimat merged 11 commits intoapache:masterfrom
merlimat:st-v5-api

Conversation

@merlimat
Copy link
Copy Markdown
Contributor

@merlimat merlimat commented Apr 8, 2026

Summary

Implementation of PIP-466: New Java Client API (V5) for scalable topic support.

  • Introduces the pulsar-client-api-v5 module with type-safe interfaces for scalable topics
  • Producer: Producer / ProducerBuilder with key-based routing, flow control, and async variants
  • StreamConsumer: exclusive segment assignment with key-ordered delivery, controller-coordinated rebalancing
  • QueueConsumer: shared dispatch across all segments, no controller required
  • CheckpointConsumer: externalized position tracking via serializable Checkpoint snapshots for stream processing frameworks (Flink, Beam)
  • PulsarClient / PulsarClientBuilder: entry point with ServiceLoader-based provider discovery
  • Async counterparts (AsyncProducer, AsyncStreamConsumer, AsyncQueueConsumer, AsyncCheckpointConsumer) for non-blocking usage
  • Schema, auth, config, and internal provider packages
  • Comprehensive usage examples in Examples.java

Related PIPs:

Test plan

  • Module compiles as part of full Gradle build
  • Integration tests with V5 client implementation (separate PR)

Introduce pulsar-client-api-v5 module with new consumer types for scalable
topics: StreamConsumer, QueueConsumer, and CheckpointConsumer. Define
Producer, Message, Schema, and PulsarClient interfaces with a clean API
design. Includes authentication, crypto, batching/compression config types,
and a ServiceLoader-based PulsarClientProvider SPI.
@merlimat merlimat changed the title Add V5 client API for scalable topics [feat] PIP-466: Add V5 client API for scalable topics Apr 8, 2026
@merlimat merlimat added this to the 5.0.0 milestone Apr 8, 2026
merlimat added 3 commits April 8, 2026 10:25
- Fix import ordering in Authentication, AuthenticationFactory, Schema
- Rename BUILDER type parameter to BuilderT in MessageMetadata
- Expand single-line exception constructors in PulsarClientException
- Rename uppercase Schema factory methods to camelCase
- Remove @hidden Javadoc tag from PulsarClientProvider
- Fix missing braces and import issues in Examples.java
…bleTracing

Move connection-level settings (connectionTimeout, connectionsPerBroker,
enableTcpNoDelay, keepAliveInterval, connectionMaxIdleTime, ioThreads,
callbackThreads, proxy) into a new ConnectionPolicy record with a builder.

Remove enableTracing flag — the client creates an internal OpenTelemetry
instance with metrics-only by default. Users who want tracing pass a custom
OpenTelemetry instance configured with a TracerProvider.
Copy link
Copy Markdown
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added a few review comments

Copy link
Copy Markdown
Member

@lhotari lhotari left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, minor comments. feel free to mark the comments resolved and proceed with merging after checking.

- Add CompletableFuture<Void> closeAsync() as the async counterpart of close().
- Add CompletableFuture<Transaction> newTransactionAsync() and make the
  sync newTransaction() throw PulsarClientException, matching the rest
  of the sync/async pairs in this API. Per-transaction timeout overrides
  aren't supported: the timeout lives on the client-wide TransactionPolicy
  configured via PulsarClientBuilder.transactionPolicy.
The broker reconnection backoff is a connection-level setting, so it
belongs on ConnectionPolicy alongside connectionTimeout and the other
connection knobs. Remove the top-level PulsarClientBuilder.connectionBackoff
setter and add a corresponding method on ConnectionPolicy.Builder with
an exponential (100ms → 60s) default.
The boxed Void return type didn't buy anything — callers just ignored
the null. Switch to plain void, matching Transaction.commit() alongside.
GeneratedMessageV3 is the concrete base for classic Protobuf-generated
Java classes, but Protobuf 4+ generates classes that extend Message
directly via GeneratedMessage. Widening the type bound to Message lets
the schema accept either generator style.
@merlimat merlimat merged commit 6ce15e1 into apache:master Apr 20, 2026
43 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants