The documentation you are viewing is for Dapr v0.11 which is an older version of Dapr. For up-to-date documentation, see the latest version.

Apache Kafka

Detailed documentation on the Apache Kafka pubsub component

Setup Kafka


You can run Kafka locally using this Docker image. To run without Docker, see the getting started guide here.


To run Kafka on Kubernetes, you can use the Helm Chart.

Create a Dapr component

The next step is to create a Dapr component for Kafka.

Create the following YAML file named kafka.yaml:

apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
  name: <NAME>
  namespace: <NAMESPACE>
spec:
  type: pubsub.kafka
  version: v1
  metadata:
      # Kafka broker connection setting
    - name: brokers
      # Comma separated list of kafka brokers
      value: "dapr-kafka.dapr-tests.svc.cluster.local:9092"
      # Enable auth. Default is "false"
    - name: authRequired
      value: "false"
      # Only available is authRequired is set to true
    - name: saslUsername
      value: <username>
      # Only available is authRequired is set to true
    - name: saslPassword
      value: <password>

Apply the configuration

Visit this guide for instructions on configuring pub/sub components.

Last modified July 7, 2022: update nav bar v0.11 (#2633) (b309d3d)