Skip to content

Instantly share code, notes, and snippets.

Created June 25, 2020 21:55
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
What would you like to do?
public class Program
public static void Main(string[] args)
public static IHostBuilder CreateHostBuilder(string[] args) =>
.ConfigureServices((hostContext, services) =>
// Add event processor
services.AddSingleton<IEventProcessor>(sp =>
// Create Kafka consumer and producer
var kafkaConsumer = KafkaUtils.CreateConsumer("localhost:9092", new List<string> { "raw-events" });
var kafkaProducer = KafkaUtils.CreateProducer("localhost:9092");
// Create handlers
var handlers = new List<MessageHandler> { new TransformHandler() };
// Create event processor
return new KafkaEventProcessor<int, string, int, string>(
new KafkaEventConsumer<int, string>(kafkaConsumer),
new KafkaEventProducer<int, string>(kafkaProducer, "processed-events"),
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment