MINOR: Improve ProcessorContext JavaDocs (#20042)
CI / build (push) Has been cancelled 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
parent 6351bc05aa
commit 4ce6f5cb92
2 changed files with 13 additions and 0 deletions

View File

@ -101,6 +101,13 @@ public interface ProcessorContext {
/**
* 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 <S> The type or interface of the store to return
* @return The state store instance

View File

@ -107,6 +107,12 @@ public interface ProcessingContext {
/**
* 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 <S> The type or interface of the store to return
* @return The state store instance