Skip to content

Commit 5522fba

Browse files
Document fallback scenarios on getStreamThreadsCountResolver
Single source of truth for when the framework substitutes FALLBACK_NUM_STREAM_THREADS — placed on the user-facing override point so override authors don't have to chase the trail across resolver/calculator to know what bypasses their wiring. Helper comment now points at this javadoc instead of duplicating the list.
1 parent 1c5c6ce commit 5522fba

1 file changed

Lines changed: 12 additions & 4 deletions

File tree

  • kafka-streams-framework/src/main/java/org/hypertrace/core/kafkastreams/framework

kafka-streams-framework/src/main/java/org/hypertrace/core/kafkastreams/framework/KafkaStreamsApp.java

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -288,16 +288,24 @@ public abstract StreamsBuilder buildTopology(
288288
* StreamThreadsCountResolver.optionalReplicaCount(replicaCount)));
289289
* }
290290
* }</pre>
291+
*
292+
* <p>Fallback to {@link StreamThreadsCountResolver#FALLBACK_NUM_STREAM_THREADS} occurs when:
293+
*
294+
* <ul>
295+
* <li>{@code num.stream.threads} is set to {@code DYNAMIC} but this method returns empty
296+
* <li>this method itself throws
297+
* <li>replica count supplied to the resolver is non-positive (env var unset/zero/negative)
298+
* <li>the AdminClient/calculator call throws (broker unreachable, describe timeout, etc.)
299+
* <li>the topology contains a regex/pattern source — partitions cannot be enumerated up-front
300+
* </ul>
291301
*/
292302
protected Optional<StreamThreadsCountResolver> getStreamThreadsCountResolver() {
293303
return Optional.empty();
294304
}
295305

296306
// Caller must check StreamThreadsCountResolver.isDynamic(...) before invoking. Always returns a
297-
// concrete int — every "cannot resolve" path (resolver-supplier throws, no resolver wired,
298-
// resolver returns empty for unsupported topologies / non-positive replicas / AdminClient
299-
// failure) collapses to FALLBACK_NUM_STREAM_THREADS so the literal "DYNAMIC" sentinel never
300-
// reaches Kafka Streams.
307+
// concrete int so the literal "DYNAMIC" sentinel never reaches Kafka Streams config — see
308+
// getStreamThreadsCountResolver() javadoc for the full list of fallback triggers.
301309
private int resolveDynamicStreamThreads(Map<String, Object> streamsProperties) {
302310
Optional<StreamThreadsCountResolver> resolver;
303311
try {

0 commit comments

Comments
 (0)