diff --git a/streams/src/main/java/org/apache/kafka/streams/kstream/KTable.java b/streams/src/main/java/org/apache/kafka/streams/kstream/KTable.java index f9b38bb435344..07afd7ae3d01d 100644 --- a/streams/src/main/java/org/apache/kafka/streams/kstream/KTable.java +++ b/streams/src/main/java/org/apache/kafka/streams/kstream/KTable.java @@ -29,6 +29,7 @@ import org.apache.kafka.streams.state.KeyValueStore; import org.apache.kafka.streams.state.QueryableStoreType; import org.apache.kafka.streams.state.ReadOnlyKeyValueStore; +import org.apache.kafka.streams.state.TimestampedKeyValueStore; import java.util.function.Function; @@ -47,16 +48,28 @@ * interactive queries API. * For example: *
{@code
- * final KTable table = ...
+ * final KTable table = ...;
* ...
* final KafkaStreams streams = ...;
* streams.start()
* ...
* final String queryableStoreName = table.queryableStoreName(); // returns null if KTable is not queryable
- * ReadOnlyKeyValueStore view = streams.store(queryableStoreName, QueryableStoreTypes.keyValueStore());
+ * ReadOnlyKeyValueStore view = streams.store(queryableStoreName, QueryableStoreTypes.keyValueStore());
* view.get(key);
- *}
- *+ * } + * You may also use a {@link TimestampedKeyValueStore} when querying internal state by calling the corresponding method + * on {@link QueryableStoreTypes}. + *
{@code
+ * final KTable table = ...;
+ * ...
+ * final KafkaStreams streams = ...;
+ * streams.start()
+ * ...
+ * final String queryableStoreName = table.queryableStoreName(); // returns null if KTable is not queryable
+ * ReadOnlyKeyValueStore> view = streams.store(queryableStoreName, QueryableStoreTypes.timestampedKeyValueStore());
+ * view.get(key);
+ * }
+ *
* Records from the source topic that have null keys are dropped.
*
* @param
- * To query the local {@link KeyValueStore} it must be obtained via
+ * To query the local {@link ReadOnlyKeyValueStore} it must be obtained via
* {@link KafkaStreams#store(String, QueryableStoreType) KafkaStreams#store(...)}:
*
- * To query the local {@link KeyValueStore} it must be obtained via
+ * To query the local {@link ReadOnlyKeyValueStore} it must be obtained via
* {@link KafkaStreams#store(String, QueryableStoreType) KafkaStreams#store(...)}:
*
- * To query the local {@link KeyValueStore} it must be obtained via
+ * To query the local {@link ReadOnlyKeyValueStore} it must be obtained via
* {@link KafkaStreams#store(String, QueryableStoreType) KafkaStreams#store(...)}:
*
- * To query the local {@link KeyValueStore} it must be obtained via
+ * To query the local {@link ReadOnlyKeyValueStore} it must be obtained via
* {@link KafkaStreams#store(String, QueryableStoreType) KafkaStreams#store(...)}:
* {@code
- * KafkaStreams streams = ... // filtering words
- * ReadOnlyKeyValueStore
* For non-local keys, a custom RPC mechanism must be implemented using {@link KafkaStreams#allMetadata()} to
* query the value of the key on a parallel running instance of your Kafka Streams application.
@@ -169,13 +182,13 @@ KTable{@code
- * KafkaStreams streams = ... // filtering words
- * ReadOnlyKeyValueStore
* For non-local keys, a custom RPC mechanism must be implemented using {@link KafkaStreams#allMetadata()} to
* query the value of the key on a parallel running instance of your Kafka Streams application.
@@ -255,13 +268,13 @@ KTable{@code
- * KafkaStreams streams = ... // filtering words
- * ReadOnlyKeyValueStore
* For non-local keys, a custom RPC mechanism must be implemented using {@link KafkaStreams#allMetadata()} to
* query the value of the key on a parallel running instance of your Kafka Streams application.
@@ -293,13 +306,13 @@ KTable{@code
- * KafkaStreams streams = ... // filtering words
- * ReadOnlyKeyValueStore
* For non-local keys, a custom RPC mechanism must be implemented using {@link KafkaStreams#allMetadata()} to
* query the value of the key on a parallel running instance of your Kafka Streams application.