Overview on setting up of pub/sub components for Dapr

Dapr integrates with pub/sub message buses to provide applications with the ability to create event-driven, loosely coupled architectures where producers send events to consumers via topics.

Dapr supports the configuration of multiple, named, pub/sub components per application. Each pub/sub component has a name and this name is used when publishing a message topic. Read the API reference for details on how to publish and subscribe to topics.

Pub/sub components are extensible. A list of support pub/sub components is here and the implementations can be found in the components-contrib repo.

A pub/sub in Dapr is described using a Component file:

apiVersion: dapr.io/v1alpha1
kind: Component
  name: pubsub
  namespace: default
  type: pubsub.<NAME>
  version: v1
  - name: <KEY>
    value: <VALUE>
  - name: <KEY>
    value: <VALUE>

The type of pub/sub is determined by the type field, and properties such as connection strings and other metadata are put in the .metadata section. Even though you can put plain text secrets in there, it is recommended you use a secret store using a secretKeyRef

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