StreamsMetadataState¶
StreamsMetadataState is used by a KafkaStreams instance to manage global metadata (of all the KafkaStreamss of a Kafka Streams application).
Creating Instance¶
StreamsMetadataState takes the following to be created:
- InternalTopologyBuilder
- User-Defined Endpoint
StreamsMetadataState is created when:
KafkaStreamsis created
Global Metadata¶
List<StreamsMetadata> allMetadata
StreamsMetadataState uses a allMetadata internal registry for all StreamsMetadatas.
The allMetadata registry is initially empty and rebuilt every onChange.
The allMetadata registry is available using KafkaStreams.metadataForAllStreamsClients.
Used when:
onChange¶
void onChange(
Map<HostInfo, Set<TopicPartition>> activePartitionHostMap,
Map<HostInfo, Set<TopicPartition>> standbyPartitionHostMap,
Cluster clusterMetadata)
onChange stores the given Cluster metadata (in the clusterMetadata internal registry) and rebuildMetadata.
onChange is used when:
StreamsPartitionAssignoris requested to assign and onAssignment
rebuildMetadata¶
void rebuildMetadata(
Map<HostInfo, Set<TopicPartition>> activePartitionHostMap,
Map<HostInfo, Set<TopicPartition>> standbyPartitionHostMap)
rebuildMetadata...FIXME
getKeyQueryMetadataForKey¶
KeyQueryMetadata getKeyQueryMetadataForKey(
String storeName,
K key,
Serializer<K> keySerializer) // (1)
KeyQueryMetadata getKeyQueryMetadataForKey(
String storeName,
K key,
StreamPartitioner<? super K, ?> partitioner)
KeyQueryMetadata getKeyQueryMetadataForKey(
String storeName,
K key,
StreamPartitioner<? super K, ?> partitioner,
SourceTopicsInfo sourceTopicsInfo) // (2)
- Uses
DefaultStreamPartitioner - A private method
getKeyQueryMetadataForKey...FIXME
getKeyQueryMetadataForKey is used when:
KafkaStreamsis requested to queryMetadataForKey