docs/howto/setup-pub-sub-message-broker
Kyle Housley 9d74ecb4e8
Add instructions for setting up kafka for use with dapr (#551)
* Add instructions for setting up kafka for use with dapr

* Update setup-kafka.md

Co-authored-by: Aman Bhardwaj <amanbha@users.noreply.github.com>
Co-authored-by: Yaron Schneider <yaronsc@microsoft.com>
2020-05-04 14:02:17 -07:00
..
README.md Add azure event hubs pub/sub how to (#561) 2020-05-04 13:44:52 -07:00
setup-azure-eventhubs.md Add azure event hubs pub/sub how to (#561) 2020-05-04 13:44:52 -07:00
setup-azure-servicebus.md namespace in all yaml samples 2020-05-02 04:04:13 -07:00
setup-gcp.md namespace in all yaml samples 2020-05-02 04:01:14 -07:00
setup-hazelcast.md namespace in all yaml samples 2020-05-02 04:01:14 -07:00
setup-kafka.md Add instructions for setting up kafka for use with dapr (#551) 2020-05-04 14:02:17 -07:00
setup-nats.md namespace in all yaml samples 2020-05-02 04:01:14 -07:00
setup-rabbitmq.md namespace in all yaml samples 2020-05-02 04:01:14 -07:00
setup-redis.md namespace in all yaml samples 2020-05-02 04:01:14 -07:00

README.md

Setup a Dapr pub/sub

Dapr integrates with existing message buses to provide apps with the ability to create event-driven, loosely coupled architectures where producers send events to consumers via topics. Currently, Dapr supports the configuration of one message bus per cluster.

Pub/Sub message buses are extensible and 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
metadata:
  name: messagebus
  namespace: default
spec:
  type: pubsub.<NAME>
  metadata:
  - name: <KEY>
    value: <VALUE>
  - name: <KEY>
    value: <VALUE>
...

The type of message bus is determined by the type field, and things like 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.

Running locally

When running locally with the Dapr CLI, a component file for a Redis Streams pub/sub will be automatically created in a components directory in your current working directory.

You can make changes to this file the way you see fit, whether to change connection values or replace it with a different pub/sub.

Running in Kubernetes

Dapr uses a Kubernetes Operator to update the sidecars running in the cluster with different components. To setup a pub/sub in Kubernetes, use kubectl to apply the component file:

kubectl apply -f pubsub.yaml

Reference