Пример #1
0
        private async Task InitializeInternalTopicManagerAsync()
        {
            // Create internal topics (changelogs & repartition) if need
            var adminClientInternalTopicManager = kafkaSupplier.GetAdmin(configuration.ToAdminConfig(StreamThread.GetSharedAdminClientId($"{configuration.ApplicationId.ToLower()}-admin-internal-topic-manager")));

            using (var internalTopicManager = new DefaultTopicManager(configuration, adminClientInternalTopicManager))
                await InternalTopicManagerUtils.New().CreateInternalTopicsAsync(internalTopicManager, topology.Builder);
        }
Пример #2
0
        private void InitializeInternalTopicManager()
        {
            // Create internal topics (changelogs & repartition) if need
            var adminClientInternalTopicManager = supplier.GetAdmin(configuration.ToAdminConfig(
                                                                        StreamThread.GetSharedAdminClientId(
                                                                            $"{configuration.ApplicationId.ToLower()}-admin-internal-topic-manager")));

            internalTopicManager = new DefaultTopicManager(configuration, adminClientInternalTopicManager);

            InternalTopicManagerUtils
            .New()
            .CreateSourceTopics(builder, supplier)
            .CreateInternalTopicsAsync(internalTopicManager, builder)
            .GetAwaiter()
            .GetResult();
        }
Пример #3
0
        public void Init()
        {
            token1 = new System.Threading.CancellationTokenSource();
            token2 = new System.Threading.CancellationTokenSource();

            config.ApplicationId = "test-stream-thread";
            config.StateDir      = Path.Combine(".", Guid.NewGuid().ToString());
            config.Guarantee     = ProcessingGuarantee.AT_LEAST_ONCE;
            config.PollMs        = 10;

            mockKafkaSupplier = new MockKafkaSupplier(2, 0);

            var builder = new StreamBuilder();

            builder.Table("topic", InMemory <string, string> .As("store").WithLoggingEnabled());

            var topo = builder.Build();

            topo.Builder.RewriteTopology(config);
            topo.Builder.BuildTopology();

            thread1 = StreamThread.Create(
                "thread-0", "c0",
                topo.Builder, new StreamMetricsRegistry(), config,
                mockKafkaSupplier, mockKafkaSupplier.GetAdmin(config.ToAdminConfig("admin")),
                0) as StreamThread;

            thread2 = StreamThread.Create(
                "thread-1", "c1",
                topo.Builder, new StreamMetricsRegistry(), config,
                mockKafkaSupplier, mockKafkaSupplier.GetAdmin(config.ToAdminConfig("admin")),
                1) as StreamThread;

            var internalTopicManager =
                new DefaultTopicManager(config, mockKafkaSupplier.GetAdmin(config.ToAdminConfig("admin")));

            InternalTopicManagerUtils
            .New()
            .CreateInternalTopicsAsync(internalTopicManager, topo.Builder).GetAwaiter();
        }