Skip to content
Bernardo Teixeira edited this page Oct 26, 2021 · 3 revisions

I'm using Confluent.Kafka version 1.8.1. I'm also Serilog for all the logging and Newtonsoft.Json for serialization and deserialization.

Register

To register the ApolloBus, you need to AddKafka(...) StartupFile

  public void ConfigureServices(IServiceCollection services)
  {
     services.AddKafka(Configuration);
      ...
  }

To add the configuration, you need to write in your appsettings the following code.

  "Kafka": {
    "ProducerConfig": {
      "BootstrapServers": "localhost:9092",
      "MessageTimeoutMs": "10000"
    },
    "ConsumerConfig": {
      "BootstrapServers": "localhost:9092"
    }
  }

To add configuration we need to add the object ProducerConfig and ConsumerConfig