Class StreamsMetadataState
- java.lang.Object
-
- org.apache.kafka.streams.processor.internals.StreamsMetadataState
-
public class StreamsMetadataState extends java.lang.Object
Provides access to theStreamsMetadata
in a KafkaStreams application. This can be used to discover the locations ofStateStore
s in a KafkaStreams application
-
-
Field Summary
Fields Modifier and Type Field Description static HostInfo
UNKNOWN_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 theStreamsMetadata
s in aapplication
java.util.Collection<StreamsMetadata>
getAllMetadataForStore(java.lang.String storeName)
Find all of theStreamsMetadata
s for a given storeName<K> KeyQueryMetadata
getKeyQueryMetadataForKey(java.lang.String storeName, K key, org.apache.kafka.common.serialization.Serializer<K> keySerializer)
Find theKeyQueryMetadata
s for a given storeName and key.<K> KeyQueryMetadata
getKeyQueryMetadataForKey(java.lang.String storeName, K key, StreamPartitioner<? super K,?> partitioner)
Find theKeyQueryMetadata
s for a given storeName and key Note: the key may not exist in theStateStore
,this method provides a way of finding whichStreamsMetadata
it would exist on.StreamsMetadata
getLocalMetadata()
Get theStreamsMetadata
s for the local instance in aapplication
<K> StreamsMetadata
getMetadataWithKey(java.lang.String storeName, K key, org.apache.kafka.common.serialization.Serializer<K> keySerializer)
Deprecated.<K> StreamsMetadata
getMetadataWithKey(java.lang.String storeName, K key, StreamPartitioner<? super K,?> partitioner)
Deprecated.java.lang.String
getStoreForChangelogTopic(java.lang.String topicName)
java.lang.String
toString()
java.lang.String
toString(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:
toString
in classjava.lang.Object
-
toString
public java.lang.String toString(java.lang.String indent)
-
getLocalMetadata
public StreamsMetadata getLocalMetadata()
Get theStreamsMetadata
s for the local instance in aapplication
- Returns:
- the
StreamsMetadata
s for the local instance in aKafkaStreams
application
-
getAllMetadata
public java.util.Collection<StreamsMetadata> getAllMetadata()
Find all of theStreamsMetadata
s in aapplication
- Returns:
- all the
StreamsMetadata
s in aKafkaStreams
application
-
getAllMetadataForStore
public java.util.Collection<StreamsMetadata> getAllMetadataForStore(java.lang.String storeName)
Find all of theStreamsMetadata
s for a given storeName- Parameters:
storeName
- the storeName to find metadata for- Returns:
- A collection of
StreamsMetadata
that 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 theStreamsMetadata
s for a given storeName and key. This method will use theDefaultStreamPartitioner
to 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 whichStreamsMetadata
it would exist on.- Type Parameters:
K
- key type- Parameters:
storeName
- Name of the storekey
- Key to usekeySerializer
- Serializer for the key- Returns:
- The
StreamsMetadata
for the storeName and key orStreamsMetadata.NOT_AVAILABLE
if streams is (re-)initializing, ornull
if 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 theKeyQueryMetadata
s for a given storeName and key. This method will use theDefaultStreamPartitioner
to 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 whichKeyQueryMetadata
it would exist on.- Type Parameters:
K
- key type- Parameters:
storeName
- Name of the storekey
- Key to usekeySerializer
- Serializer for the key- Returns:
- The
KeyQueryMetadata
for the storeName and key orKeyQueryMetadata.NOT_AVAILABLE
if streams is (re-)initializing ornull
if 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 theKeyQueryMetadata
s for a given storeName and key Note: the key may not exist in theStateStore
,this method provides a way of finding whichStreamsMetadata
it 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
KeyQueryMetadata
for the storeName and key orKeyQueryMetadata.NOT_AVAILABLE
if streams is (re-)initializing, ornull
if no matching metadata could be found.
-
getMetadataWithKey
@Deprecated public <K> StreamsMetadata getMetadataWithKey(java.lang.String storeName, K key, StreamPartitioner<? super K,?> partitioner)
Deprecated.Find theStreamsMetadata
s for a given storeName and key. Note: the key may not exist in theStateStore
, this method provides a way of finding whichStreamsMetadata
it 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
StreamsMetadata
for the storeName and key orStreamsMetadata.NOT_AVAILABLE
if streams is (re-)initializing, ornull
if no matching metadata could be found.
-
getStoreForChangelogTopic
public java.lang.String getStoreForChangelogTopic(java.lang.String topicName)
-
-