static async Task Main(string[] args) { string inputTopic = "input", outputTopic = "output"; int numberPartitions = 4; await CreateTopics(inputTopic, outputTopic, numberPartitions); var config = new StreamConfig <StringSerDes, StringSerDes>(); config.ApplicationId = "sample-streamiz-demo"; config.BootstrapServers = "localhost:9092"; config.AutoOffsetReset = AutoOffsetReset.Earliest; config.StateDir = Path.Combine("."); config.CommitIntervalMs = 5000; config.Guarantee = ProcessingGuarantee.AT_LEAST_ONCE; config.MetricsRecording = MetricsRecordingLevel.DEBUG; config.UsePrometheusReporter(9090, true); StreamBuilder builder = new StreamBuilder(); builder.Stream <string, string>(inputTopic) .FlatMapValues((v) => v.Split(" ").AsEnumerable()) .GroupBy((k, v) => v) .Count() .ToStream() .MapValues((v) => v.ToString()) .To(outputTopic); Topology t = builder.Build(); KafkaStream stream = new KafkaStream(t, config); Console.CancelKeyPress += (o, e) => stream.Dispose(); await stream.StartAsync(); }