コード例 #1
0
 private static void ComputeRepartitionTopicConfig(
     InternalTopologyBuilder.TopologyTopicsInfo topicsInfo,
     IDictionary <int, InternalTopologyBuilder.TopologyTopicsInfo> topologyTopicInfos,
     Metadata clusterMetadata)
 {
     if (topicsInfo.RepartitionTopics.Any())
     {
         CheckIfExternalSourceTopicsExist(topicsInfo, clusterMetadata);
         SetRepartitionSourceTopicPartitionCount(topicsInfo.RepartitionTopics, topologyTopicInfos,
                                                 clusterMetadata);
     }
 }
コード例 #2
0
        private static void CheckIfExternalSourceTopicsExist(InternalTopologyBuilder.TopologyTopicsInfo topicsInfo, Metadata clusterMetadata)
        {
            List <string> sourcesTopics = new List <string>(topicsInfo.SourceTopics);

            sourcesTopics.RemoveAll(topicsInfo.RepartitionTopics.Keys);
            sourcesTopics.RemoveAll(clusterMetadata.Topics.Select(t => t.Topic));
            if (sourcesTopics.Any())
            {
                log.LogError($"Topology use one (or multiple) repartition topic(s)." +
                             $" The following source topics ({string.Join(",", sourcesTopics)}) are missing/unknown." +
                             $" Please make sure all sources topics have been-created before starting the streams application.");
                throw new StreamsException($"Missing source topics : {string.Join(",", sourcesTopics)}.");
            }
        }
コード例 #3
0
        private static void ComputeChangelogTopicConfig(InternalTopologyBuilder.TopologyTopicsInfo topicsInfo,
                                                        Metadata clusterMetadata, List <DescribeConfigsResult> resultsConf)
        {
            var topic = clusterMetadata.Topics.FirstOrDefault(t => t.Topic.Equals(topicsInfo.SourceTopics.First()));

            if (topic != null)
            {
                topicsInfo
                .ChangelogTopics
                .Values
                .ForEach(c => c.NumberPartitions = topic.Partitions.Count);
            }
            else
            {
                topicsInfo
                .ChangelogTopics
                .Values
                .ForEach(c => c.NumberPartitions = DefaultPartitionNumber(resultsConf));
            }
        }