MINOR: Improve ProcessorContext JavaDocs (#20042)
CI / build (push) Waiting to run Details

Clarify that state stores are sharded, and shards cannot be shared
across Processors.

Reviewers: Lucas Brutschy <lbrutschy@confluent.io>
This commit is contained in:
Matthias J. Sax 2025-06-26 10:06:46 -07:00 committed by GitHub
parent 96ef1c520a
commit 53faeb85ef
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 13 additions and 0 deletions

View File

@ -105,6 +105,13 @@ public interface ProcessorContext {
/** /**
* Get the state store given the store name. * Get the state store given the store name.
* *
* <p>The returned state store represent one shard of the overall state, which belongs to the current task.
* The returned shard of the state store may only be used by the current
* {@link org.apache.kafka.streams.kstream.Transformer}, {@link org.apache.kafka.streams.kstream.ValueTransformer},
* or {@link org.apache.kafka.streams.kstream.ValueTransformerWithKey} instance.
* Sharing a shard across different transformers (ie, from different "sibling" tasks; same sub-topology but different
* partition) may lead to data corruption and/or data loss.
*
* @param name The store name * @param name The store name
* @param <S> The type or interface of the store to return * @param <S> The type or interface of the store to return
* @return The state store instance * @return The state store instance

View File

@ -107,6 +107,12 @@ public interface ProcessingContext {
/** /**
* Get the state store given the store name. * Get the state store given the store name.
* *
* <p>The returned state store represent one shard of the overall state, which belongs to the current task.
* The returned shard of the state store may only be used by the current {@link Processor} or
* {@link FixedKeyProcessor} instance.
* Sharing a shard across different processors (ie, from different "sibling" tasks; same sub-topology but different
* partition) may lead to data corruption and/or data loss.
*
* @param name The store name * @param name The store name
* @param <S> The type or interface of the store to return * @param <S> The type or interface of the store to return
* @return The state store instance * @return The state store instance