New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: Add the PartitionCountWatchingPublisher #387
Conversation
...loud-pubsublite/src/main/java/com/google/cloud/pubsublite/internal/DefaultRoutingPolicy.java
Show resolved
Hide resolved
publishers.values().forEach(ApiService::stopAsync); | ||
publishers.values().forEach(ApiService::awaitTerminated); | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Isn't this RoutingPublisher, almost exactly? Can't you just use RoutingPublisher for this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So I spent a while trying to do that. The awkward bit is that RoutingPublisher is a ProxyApiService which contains all of its partition level publishers.
This makes it challenging to install an new routing publisher when the number of partitions changes, since it's not currently possible to add started services to a ProxyApiService, and it's not possible to remove services either.
...src/main/java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisher.java
Outdated
Show resolved
Hide resolved
...n/java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisherBuilder.java
Outdated
Show resolved
Hide resolved
...test/java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisherTest.java
Outdated
Show resolved
Hide resolved
...test/java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisherTest.java
Outdated
Show resolved
Hide resolved
...test/java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisherTest.java
Outdated
Show resolved
Hide resolved
ddfe237
to
38fdaa4
Compare
Codecov Report
@@ Coverage Diff @@
## master #387 +/- ##
============================================
+ Coverage 72.39% 72.83% +0.44%
- Complexity 783 801 +18
============================================
Files 148 150 +2
Lines 4191 4300 +109
Branches 204 215 +11
============================================
+ Hits 3034 3132 +98
- Misses 1042 1050 +8
- Partials 115 118 +3
Continue to review full report at Codecov.
|
...src/main/java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisher.java
Outdated
Show resolved
Hide resolved
...src/main/java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisher.java
Outdated
Show resolved
Hide resolved
.../java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisherSettings.java
Show resolved
Hide resolved
.../java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisherSettings.java
Show resolved
Hide resolved
...test/java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisherTest.java
Show resolved
Hide resolved
...test/java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisherTest.java
Outdated
Show resolved
Hide resolved
...test/java/com/google/cloud/pubsublite/internal/wire/PartitionCountWatchingPublisherTest.java
Show resolved
Hide resolved
4cd7369
to
ce81ab2
Compare
This publisher watches the partition count and adds partitions when the topic's partition count increases.