Class StreamsMetadataState
- java.lang.Object
-
- org.apache.kafka.streams.processor.internals.StreamsMetadataState
-
public class StreamsMetadataState extends java.lang.ObjectProvides access to theStreamsMetadatain a KafkaStreams application. This can be used to discover the locations ofStateStores in a KafkaStreams application
-
-
Field Summary
Fields Modifier and Type Field Description static HostInfoUNKNOWN_HOST
-
Constructor Summary
Constructors Constructor Description StreamsMetadataState(InternalTopologyBuilder builder, HostInfo thisHost)
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description java.util.Collection<StreamsMetadata>getAllMetadata()Find all of theStreamsMetadatas in aapplicationjava.util.Collection<StreamsMetadata>getAllMetadataForStore(java.lang.String storeName)Find all of theStreamsMetadatas for a given storeName<K> KeyQueryMetadatagetKeyQueryMetadataForKey(java.lang.String storeName, K key, org.apache.kafka.common.serialization.Serializer<K> keySerializer)Find theKeyQueryMetadatas for a given storeName and key.<K> KeyQueryMetadatagetKeyQueryMetadataForKey(java.lang.String storeName, K key, StreamPartitioner<? super K,?> partitioner)Find theKeyQueryMetadatas for a given storeName and key Note: the key may not exist in theStateStore,this method provides a way of finding whichStreamsMetadatait would exist on.StreamsMetadatagetLocalMetadata()Get theStreamsMetadatas for the local instance in aapplication<K> StreamsMetadatagetMetadataWithKey(java.lang.String storeName, K key, org.apache.kafka.common.serialization.Serializer<K> keySerializer)Deprecated.<K> StreamsMetadatagetMetadataWithKey(java.lang.String storeName, K key, StreamPartitioner<? super K,?> partitioner)Deprecated.java.lang.StringgetStoreForChangelogTopic(java.lang.String topicName)java.lang.StringtoString()java.lang.StringtoString(java.lang.String indent)
-
-
-
Field Detail
-
UNKNOWN_HOST
public static final HostInfo UNKNOWN_HOST
-
-
Constructor Detail
-
StreamsMetadataState
public StreamsMetadataState(InternalTopologyBuilder builder, HostInfo thisHost)
-
-
Method Detail
-
toString
public java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
toString
public java.lang.String toString(java.lang.String indent)
-
getLocalMetadata
public StreamsMetadata getLocalMetadata()
Get theStreamsMetadatas for the local instance in aapplication- Returns:
- the
StreamsMetadatas for the local instance in aKafkaStreamsapplication
-
getAllMetadata
public java.util.Collection<StreamsMetadata> getAllMetadata()
Find all of theStreamsMetadatas in aapplication- Returns:
- all the
StreamsMetadatas in aKafkaStreamsapplication
-
getAllMetadataForStore
public java.util.Collection<StreamsMetadata> getAllMetadataForStore(java.lang.String storeName)
Find all of theStreamsMetadatas for a given storeName- Parameters:
storeName- the storeName to find metadata for- Returns:
- A collection of
StreamsMetadatathat have the provided storeName
-
getMetadataWithKey
@Deprecated public <K> StreamsMetadata getMetadataWithKey(java.lang.String storeName, K key, org.apache.kafka.common.serialization.Serializer<K> keySerializer)
Deprecated.Find theStreamsMetadatas for a given storeName and key. This method will use theDefaultStreamPartitionerto locate the store. If a custom partitioner has been used please usegetMetadataWithKey(String, Object, StreamPartitioner)Note: the key may not exist in theStateStore, this method provides a way of finding whichStreamsMetadatait would exist on.- Type Parameters:
K- key type- Parameters:
storeName- Name of the storekey- Key to usekeySerializer- Serializer for the key- Returns:
- The
StreamsMetadatafor the storeName and key orStreamsMetadata.NOT_AVAILABLEif streams is (re-)initializing, ornullif no matching metadata could be found.
-
getKeyQueryMetadataForKey
public <K> KeyQueryMetadata getKeyQueryMetadataForKey(java.lang.String storeName, K key, org.apache.kafka.common.serialization.Serializer<K> keySerializer)
Find theKeyQueryMetadatas for a given storeName and key. This method will use theDefaultStreamPartitionerto locate the store. If a custom partitioner has been used please usegetKeyQueryMetadataForKey(String, Object, StreamPartitioner)instead. Note: the key may not exist in theStateStore, this method provides a way of finding whichKeyQueryMetadatait would exist on.- Type Parameters:
K- key type- Parameters:
storeName- Name of the storekey- Key to usekeySerializer- Serializer for the key- Returns:
- The
KeyQueryMetadatafor the storeName and key orKeyQueryMetadata.NOT_AVAILABLEif streams is (re-)initializing ornullif the corresponding topic cannot be found, or null if no matching metadata could be found.
-
getKeyQueryMetadataForKey
public <K> KeyQueryMetadata getKeyQueryMetadataForKey(java.lang.String storeName, K key, StreamPartitioner<? super K,?> partitioner)
Find theKeyQueryMetadatas for a given storeName and key Note: the key may not exist in theStateStore,this method provides a way of finding whichStreamsMetadatait would exist on.- Type Parameters:
K- key type- Parameters:
storeName- Name of the storekey- Key to usepartitioner- partitioner to use to find correct partition for key- Returns:
- The
KeyQueryMetadatafor the storeName and key orKeyQueryMetadata.NOT_AVAILABLEif streams is (re-)initializing, ornullif no matching metadata could be found.
-
getMetadataWithKey
@Deprecated public <K> StreamsMetadata getMetadataWithKey(java.lang.String storeName, K key, StreamPartitioner<? super K,?> partitioner)
Deprecated.Find theStreamsMetadatas for a given storeName and key. Note: the key may not exist in theStateStore, this method provides a way of finding whichStreamsMetadatait would exist on.- Type Parameters:
K- key type- Parameters:
storeName- Name of the storekey- Key to usepartitioner- partitioner to use to find correct partition for key- Returns:
- The
StreamsMetadatafor the storeName and key orStreamsMetadata.NOT_AVAILABLEif streams is (re-)initializing, ornullif no matching metadata could be found.
-
getStoreForChangelogTopic
public java.lang.String getStoreForChangelogTopic(java.lang.String topicName)
-
-