Repository navigation
refactor: move pub/sub out of DaprClientImpl - #1905
Merged
dapr-bot merged 1 commit intoNov 12, 2026
Merged
Conversation
Move publishEvent, publishEvents and the subscribeToEvents/subscribeToTopic overloads into a package-private DaprPubSubClient. The public methods on DaprClientImpl now delegate to it. Add DaprGrpcCalls.intercept() for the subscription paths, which run without a Reactor context, and drop the asyncStub field that DaprClientImpl no longer reads. Part of dapr#1875 Signed-off-by: Javier Aliaga <javier@diagrid.io>
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues are present, and the refactoring preserves the existing public pub/sub API while separating its implementation into a dedicated client.
No open issues 🎉
What changed in this PR
This PR refactors pub/sub operations out of DaprClientImpl into a package-private DaprPubSubClient, preserving the existing public API and behavior while reducing the main client's responsibilities.
Changes:
- Moved publishing and subscription implementations into
DaprPubSubClient. - Added shared async gRPC stub interception through
DaprGrpcCalls. - Updated
DaprClientImplto delegate pub/sub methods and removed its direct async stub dependency.
| File | Description |
|---|---|
| sdk/src/main/java/io/dapr/client/DaprPubSubClient.java | Adds the package-private implementation for pub/sub publishing, subscriptions, and subscription handling. |
| sdk/src/main/java/io/dapr/client/DaprGrpcCalls.java | Adds shared interception of the async gRPC stub for calls without a Reactor context. |
| sdk/src/main/java/io/dapr/client/DaprClientImpl.java | Initializes the pub/sub client and delegates the existing public pub/sub methods. |
Review effort: Lite
javier-aliaga
marked this pull request as ready for review
November 12, 2026 12:21
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #1905 +/- ##
============================================
+ Coverage 81.93% 82.00% +0.06%
- Complexity 3651 3664 +13
============================================
Files 330 331 +1
Lines 11351 11367 +16
Branches 1290 1290
============================================
+ Hits 9301 9322 +21
+ Misses 1556 1550 -6
- Partials 494 495 +1 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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.
Description
Fourth step of splitting
DaprClientImplinto package-private classes, one per building block. This PR moves pub/sub.DaprPubSubClientholdspublishEvent,publishEvents(with thebulkPublishEventAlpha1fallback), thesubscribeToEventsandsubscribeToTopicoverloads, andbuildSubscription. The bodies are unchanged.grpcInterceptors.intercept(asyncStub). They now call a newDaprGrpcCalls.intercept(), which makes the same call on the same stub and interceptors.DaprClientImplno longer reads itsasyncStubfield, so the field is removed.DaprGrpcCallsstill holds the stub.DaprClientImplcategory, so existing log configuration still applies.DaprClientImplkeep their signatures and Javadoc, and delegate in one line.DaprClientImplgoes from 2,065 to 1,829 lines.Issue reference
Part of #1875
Checklist
DaprClientGrpcTest,DaprPreviewClientGrpcTestandSubscriptionTestcover pub/sub through the public methods. The 626sdkunit tests pass unchanged.