Class StreamsMetadataState
- java.lang.Object
-
- org.apache.kafka.streams.processor.internals.StreamsMetadataState
-
public class StreamsMetadataState extends 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 Collection<StreamsMetadata>
getAllMetadata()
Find all of theStreamsMetadata
s in aapplication
Collection<StreamsMetadata>
getAllMetadataForStore(String storeName)
Find all of theStreamsMetadata
s for a given storeName<K> KeyQueryMetadata
getKeyQueryMetadataForKey(String storeName, K key, Serializer<K> keySerializer)
Find theKeyQueryMetadata
s for a given storeName and key.<K> KeyQueryMetadata
getKeyQueryMetadataForKey(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(String storeName, K key, Serializer<K> keySerializer)
Deprecated.<K> StreamsMetadata
getMetadataWithKey(String storeName, K key, StreamPartitioner<? super K,?> partitioner)
Deprecated.String
getStoreForChangelogTopic(String topicName)
String
toString()
String
toString(String indent)
-
-
-
Field Detail
-
UNKNOWN_HOST
public static final HostInfo UNKNOWN_HOST
-
-
Constructor Detail
-
StreamsMetadataState
public StreamsMetadataState(InternalTopologyBuilder builder, HostInfo thisHost)
-
-
Method Detail
-
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 Collection<StreamsMetadata> getAllMetadata()
Find all of theStreamsMetadata
s in aapplication
- Returns:
- all the
StreamsMetadata
s in aKafkaStreams
application
-
getAllMetadataForStore
public Collection<StreamsMetadata> getAllMetadataForStore(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(String storeName, K key, 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(String storeName, K key, 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(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(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.
-
-