Skip to content

Conversation

@anitarua
Copy link
Contributor

@anitarua anitarua commented Jun 17, 2025

Closes https://github.com/momentohq/dev-eco-issue-tracker/issues/1164

Opted for minimal config changes to maintain backwards compatibility.

  • Added WithMaxSubscriptions and an IsNumStreamChannelsDynamic flag to the TopicConfiguration
  • Topics configs will default to using a static pool of stream grpc channels for subscriptions (defaults to 4 for both unary and stream)
  • Using WithMaxSubscriptions will tell the topic client to use a dynamic pool instead (starts from 1 channel, grows to support the specified maxSubscriptions)

Also added more tests to the subscription initialization tests (part of the retry tests) to exercise the dynamic channel creation. The main difference between the static and dynamic pools are:

  • StaticStreamGrpcConnectionPool uses a regular java.util.List that is initialized once in the constructor and is never modified.
  • DynamicStreamGrpcConnectionPool uses java.util.concurrent.CopyOnWriteArrayList and AtomicInteger to be able to dynamically add channels as needed up until the maximum number of channels has been reached.

@anitarua anitarua requested a review from a team June 17, 2025 20:47
@anitarua anitarua marked this pull request as ready for review June 17, 2025 20:47
@anitarua anitarua requested a review from malandis June 18, 2025 17:24
@anitarua anitarua merged commit fda13d5 into main Jun 18, 2025
6 of 7 checks passed
@anitarua anitarua deleted the grpc-connection-pools branch June 18, 2025 23:24
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.

3 participants