Esempio n. 1
0
        public void Dispose()
        {
            var adminClient = new AdminClientBuilder(new AdminClientConfig {
                BootstrapServers = this.bootstrapServers
            }).Build();

            adminClient.DeleteTopicsAsync(new List <string> {
                Name
            }).Wait();
            adminClient.Dispose();
        }
Esempio n. 2
0
        public TemporaryTopic(string bootstrapServers, int numPartitions)
        {
            this.bootstrapServers = bootstrapServers;
            this.Name             = "dotnet_test_" + Guid.NewGuid().ToString();

            var adminClient = new AdminClientBuilder(new AdminClientConfig {
                BootstrapServers = bootstrapServers
            }).Build();

            adminClient.CreateTopicsAsync(new List <TopicSpecification> {
                new TopicSpecification {
                    Name = Name, NumPartitions = numPartitions, ReplicationFactor = 1
                }
            }).Wait();
            adminClient.Dispose();
        }