kafkaflow
kafkaflow copied to clipboard
Create Topic if not exist
Summary
Add the option to the framework to Create a Topic if not exist when a Cluster is configured.
Background and Motivation
In scenarios like demos or coding samples, it simplifies the author's life.
Proposed Feature
kafka => kafka
.UseConsoleLog()
.AddCluster(
cluster => cluster
.WithBrokers(new[] { "localhost:9092" })
.CreateTopicIfNotExists("my-topic-name", 1, 1)
.AddProducer(
...
- Add to the
ClusterConfiguration
an optionCreateTopicIfNotExists(string topicName), int numberOfPartitions, int numberOfReplicas)
Open questions
- Where's the best place to perform the task? Should we do it on
KafkaConfigurationBuilder.Build()
?
Where's the best place to perform the task? Should we do it on KafkaConfigurationBuilder.Build()?
Yes, I think it can be a good place.
Perfect. I can peek up this one and open a PR.