Skip to content

Apache Kafka®

Apache Kafka® is an open-source stream-processing software platform developed by LinkedIn and donated to the Apache Software Foundation, written in Scala and Java.

Kafka® can be used in CAP as a message transporter.


To use Kafka transporter, you need to install the following package from NuGet:

PM> Install-Package DotNetCore.CAP.Kafka

Then you can add configuration items to the ConfigureServices method of Startup.cs.

public void ConfigureServices(IServiceCollection services)
    // ...

    services.AddCap(x =>
        // x.UseXXX ...

Kafka Options

The Kafka configuration parameters provided directly by the CAP:

Servers Broker server address string
ConnectionPoolSize connection pool size int 10

Kafka MainConfig Options

If you need more native Kakfa related configuration options, you can set them in the MainConfig configuration option:

services.AddCap(capOptions => 
        // kafka options.
        // kafkaOptions.MainConfig.Add("", "");

MainConfig is a configuration dictionary, you can find a list of supported configuration options through the following link.