Clean pub sub (#172)

* Small cleanup for pub/sub

* Renamed file
This commit is contained in:
Greg Ingram 2019-10-19 17:04:20 -04:00 committed by Aman Bhardwaj
parent 3ebb53778a
commit b026f5a877
12 changed files with 26 additions and 27 deletions

View File

@ -74,11 +74,11 @@ To check, use kubectl get a list of components:
`kubectl get components`
If there isn't a pub-sub component, it means you need to set one up.
If there isn't a pub/sub component, it means you need to set one up.
Visit [here](../../howto/setup-pub-sub-message-broker/README.md) for more details.
If everything's set up correctly, make sure you got the credentials right.
Search the Dapr runtime logs and look for any pub-sub errors:
Search the Dapr runtime logs and look for any pub/sub errors:
`kubectl logs <name-of-pod> daprd`.

View File

@ -14,15 +14,15 @@ This directory contains various Dapr concepts. The goal of these documents is to
* **Components**
Dapr uses a modular design, in which functionalities are grouped and delivered by a number of *components*, such as [pub-sub](./publish-subscribe-messaging/Readme.md) and [secrets](./components/secrets.md). Many of the components are pluggable so that you can swap out the default implemenation with your custom implementations.
Dapr uses a modular design, in which functionalities are grouped and delivered by a number of *components*, such as [pub/sub](./publish-subscribe-messaging/README.md) and [secrets](./components/secrets.md). Many of the components are pluggable so that you can swap out the default implemenation with your custom implementations.
* [**Distributed Tracing**](./distributed-tracing/README.md)
Distirbuted tracing collects and aggregates trace events by transactions. It allows you to trace the entire call chain across multiple services. Dapr integrates with [OpenTelemetry](https://opentelemetry.io/) for distributed tracing and metrics collection.
* [**Pub-sub**](./publish-subscribe-messaging/Readme.md)
* [**Publish/Subscribe Messaging**](./publish-subscribe-messaging/README.md)
Pub-sub is a loosely coupled messaging pattern where senders (or publishers) publishes messages to a topic, to which subscribers subscribe. Dapr natively supports the pub-sub pattern.
Pub/Sub is a loosely coupled messaging pattern where senders (or publishers) publishes messages to a topic, to which subscribers subscribe. Dapr natively supports the pub/sub pattern.
* [**Secrets**](./components/secrets.md)

View File

@ -3,7 +3,7 @@
Dapr can use Redis in two ways:
1. For state persistence and restoration
2. For enabling pub-sub async style message delivery
2. For enabling pub/sub async style message delivery
## Creating a Redis Store
@ -13,7 +13,7 @@ Dapr can use any Redis instance - containerized, running on your local dev machi
We can use [Helm](https://helm.sh/) to quickly create a Redis instance in our Kubernetes cluster. This approach requires [Installing Helm](https://github.com/helm/helm#install).
1. Install Redis into your cluster: `helm install stable/redis --name redis --set image.tag=5.0.5-debian-9-r104`. Note that we're explicitly setting an image tag to get a version greater than 5, which is what Dapr' pub-sub functionality requires. If you're intending on using Redis as just a state store (and not for pub-sub), you do not have to set the image version.
1. Install Redis into your cluster: `helm install stable/redis --name redis --set image.tag=5.0.5-debian-9-r104`. Note that we're explicitly setting an image tag to get a version greater than 5, which is what Dapr' pub/sub functionality requires. If you're intending on using Redis as just a state store (and not for pub/sub), you do not have to set the image version.
2. Run `kubectl get pods` to see the Redis containers now running in your cluster.
3. Add `redis-master:6379` as the `redisHost` in your [redis.yaml](#configuration) file. For example:
```yaml
@ -44,7 +44,7 @@ We can use [Helm](https://helm.sh/) to quickly create a Redis instance in our Ku
5. Run `kubectl get svc` and copy the cluster IP of your `redis-master`.
6. Finally, we need to add our key and our host to a `redis.yaml` file that Dapr can apply to our cluster. If you're running a sample, you'll add the host and key to the provided `redis.yaml`. If you're creating a project from the ground up, you'll create a `redis.yaml` file as specified in [Configuration](#configuration). Set the `redisHost` key to `[IP FROM PREVIOUS STEP]:6379` and the `redisPassword` key to the key you copied in step 4. **Note:** In a production-grade application, follow [secret management](https://github.com/dapr/docs/blob/master/concepts/components/secrets.md) instructions to securely manage your secrets.
> **NOTE:** Dapr pub-sub uses [Redis Streams](https://redis.io/topics/streams-intro) that was introduced by Redis 5.0, which isn't currently available on Azure Managed Redis Cache. Consequently, you can use Azure Managed Redis Cache only for state persistence.
> **NOTE:** Dapr pub/sub uses [Redis Streams](https://redis.io/topics/streams-intro) that was introduced by Redis 5.0, which isn't currently available on Azure Managed Redis Cache. Consequently, you can use Azure Managed Redis Cache only for state persistence.
@ -55,7 +55,7 @@ We can use [Helm](https://helm.sh/) to quickly create a Redis instance in our Ku
## Configuration
Dapr can use Redis as a `statestore` component (for state persistence and retrieval) or as a `messagebus` component (for pub-sub). The following yaml files demonstrates how to define each. **Note:** yaml files below illustrate secret management in plain text. In a production-grade application, follow [secret management](https://github.com/dapr/docs/blob/master/concepts/components/secrets.md) instructions to securely manage your secrets.
Dapr can use Redis as a `statestore` component (for state persistence and retrieval) or as a `messagebus` component (for pub/sub). The following yaml files demonstrates how to define each. **Note:** yaml files below illustrate secret management in plain text. In a production-grade application, follow [secret management](https://github.com/dapr/docs/blob/master/concepts/components/secrets.md) instructions to securely manage your secrets.
### Configuring Redis for State Persistence and Retrieval

View File

@ -1,6 +1,6 @@
# Publish/Subcribe message broker
# Publish/Subcribe Messaging
Dapr enables developers to design their application using the pub/sub pattern using a message broker, where event consumers and producers are decoupled from one another, and communicate by sending and receiving messages that are associated with a namespace, usually in the form of topics.
Dapr enables developers to design their application with a pub/sub pattern using a message broker, where event consumers and producers are decoupled from one another, and communicate by sending and receiving messages that are associated with a namespace, usually in the form of topics.
This allows event producers to send messages to consumers that aren't running, and consumers to receive messages based on subscriptions to topics.
@ -11,7 +11,7 @@ These implementations are pluggable, and developed outside of the Dapr runtime i
The API for Publish/Subcribe can be found in the [spec repo](../../reference/api/pubsub.md).
## Behavior and guarantees
## Behavior and Guarantees
Dapr guarantees At-Least-Once semantics for message delivery.
That is, when an application publishes a message to a topic using the Publish/Subcribe API, it can assume the message is delivered at least once to any subscriber when the response status code from that endpoint is `200`, or returns no error if using the gRPC client.
@ -26,7 +26,7 @@ When multiple instances of the same application ID subscribe to a topic, Dapr wi
## Cloud Events
Dapr follows the [Cloud Events 0.3 spec](https://github.com/cloudevents/spec/tree/v0.3) and wraps any payload sent to a topic inside a Cloud Events envelope.
Dapr follows the [Cloud Events 0.3 Spec](https://github.com/cloudevents/spec/tree/v0.3) and wraps any payload sent to a topic inside a Cloud Events envelope.
The following fields from the Cloud Events spec are implemented with Dapr:

View File

@ -30,4 +30,3 @@ Here you'll find a list of How To guides that walk you through accomplishing spe
### Autoscaling
* [Autoscale on Kubernetes using KEDA and Dapr bindings](./autoscale-with-keda)

View File

@ -1,17 +1,17 @@
# Use Pub Sub to consume messages from topics
# Use Pub/Sub to consume messages from topics
Pub-Sub is a very common pattern in a distributed system with many services that want to utilize decoupled, asynchronous messaging.
Using Pub-Sub, you can enable scnearios where event consumers are decoupled from event producers.
Pub/Sub is a very common pattern in a distributed system with many services that want to utilize decoupled, asynchronous messaging.
Using Pub/Sub, you can enable scnearios where event consumers are decoupled from event producers.
Dapr provides an extensible Pub-Sub system with At-Least-Once guarantees, allowing developers to publish and subscribe to topics.
Dapr provides an extensible Pub/Sub system with At-Least-Once guarantees, allowing developers to publish and subscribe to topics.
Dapr provides different implementation of the underlying system, and allows operators to bring in their preferred infrastructure, for example Redis Streams, Kafka, etc.
## Setup the Pub Sub component
The first step is to setup the Pub-Sub component.
The first step is to setup the Pub/Sub component.
For this guide, we'll use Redis Streams, which is also installed by default on a local machine when running `dapr init`.
*Note: When running Dapr locally, a pub-sub component YAML will automatically be created if it doesn't exist in a directory called `components` in your current working directory.*
*Note: When running Dapr locally, a pub/sub component YAML will automatically be created if it doesn't exist in a directory called `components` in your current working directory.*
```
apiVersion: dapr.io/v1alpha1

View File

@ -3,7 +3,7 @@
A common scenario in distributed computing is to only allow for a given number of requests to execute concurrently.
Using Dapr, you can control how many requests and events will invoke your application simultaneously.
*Note that this rate limiting is guaranteed for every event that's coming from Dapr, meaning Pub-Sub events, direct invocation from other services, bindings events etc. Dapr can't enforce the concurrency policy on requests that are coming to your app externally.*
*Note that this rate limiting is guaranteed for every event that's coming from Dapr, meaning Pub/Sub events, direct invocation from other services, bindings events etc. Dapr can't enforce the concurrency policy on requests that are coming to your app externally.*
## Setting max-concurrency

View File

@ -13,7 +13,7 @@ The Redis instance will be installed via Docker when you run `dapr init`, and th
We can use [Helm](https://helm.sh/) to quickly create a Redis instance in our Kubernetes cluster. This approach requires [Installing Helm](https://github.com/helm/helm#install).
1. Install Redis into your cluster: `helm install stable/redis --name redis --set image.tag=5.0.5-debian-9-r104`. Note that we're explicitly setting an image tag to get a version greater than 5, which is what Dapr' pub-sub functionality requires.
1. Install Redis into your cluster: `helm install stable/redis --name redis --set image.tag=5.0.5-debian-9-r104`. Note that we're explicitly setting an image tag to get a version greater than 5, which is what Dapr' pub/sub functionality requires.
2. Run `kubectl get pods` to see the Redis containers now running in your cluster.
3. Add `redis-master:6379` as the `redisHost` in your redis.yaml file. For example:
```yaml

View File

@ -8,7 +8,7 @@ Dapr can use any Redis instance - containerized, running on your local dev machi
We can use [Helm](https://helm.sh/) to quickly create a Redis instance in our Kubernetes cluster. This approach requires [Installing Helm](https://github.com/helm/helm#install).
1. Install Redis into your cluster: `helm install stable/redis --name redis --set image.tag=5.0.5-debian-9-r104`. Note that we're explicitly setting an image tag to get a version greater than 5, which is what Dapr' pub-sub functionality requires. If you're intending on using Redis as just a state store (and not for pub-sub), you do not have to set the image version.
1. Install Redis into your cluster: `helm install stable/redis --name redis --set image.tag=5.0.5-debian-9-r104`. Note that we're explicitly setting an image tag to get a version greater than 5, which is what Dapr' pub/sub functionality requires. If you're intending on using Redis as just a state store (and not for pub/sub), you do not have to set the image version.
2. Run `kubectl get pods` to see the Redis containers now running in your cluster.
3. Add `redis-master:6379` as the `redisHost` in your [redis.yaml](#configuration) file. For example:
```yaml
@ -39,7 +39,7 @@ We can use [Helm](https://helm.sh/) to quickly create a Redis instance in our Ku
5. Run `kubectl get svc` and copy the cluster IP of your `redis-master`.
6. Finally, we need to add our key and our host to a `redis.yaml` file that Dapr can apply to our cluster. If you're running a sample, you'll add the host and key to the provided `redis.yaml`. If you're creating a project from the ground up, you'll create a `redis.yaml` file as specified in [Configuration](#configuration). Set the `redisHost` key to `[IP FROM PREVIOUS STEP]:6379` and the `redisPassword` key to the key you copied in step 4. **Note:** In a production-grade application, follow [secret management](https://github.com/dapr/docs/blob/master/concepts/components/secrets.md) instructions to securely manage your secrets.
> **NOTE:** Dapr pub-sub uses [Redis Streams](https://redis.io/topics/streams-intro) that was introduced by Redis 5.0, which isn't currently available on Azure Managed Redis Cache. Consequently, you can use Azure Managed Redis Cache only for state persistence.
> **NOTE:** Dapr pub/sub uses [Redis Streams](https://redis.io/topics/streams-intro) that was introduced by Redis 5.0, which isn't currently available on Azure Managed Redis Cache. Consequently, you can use Azure Managed Redis Cache only for state persistence.
### Other ways to create a Redis Database

View File

@ -72,4 +72,4 @@ In order to give your service an id and port known to Dapr and launch the Dapr s
annotations:
dapr.io/enabled: "true"
dapr.io/id: "nodeapp"
dapr.io/port: "3000"
dapr.io/port: "3000"

View File

@ -3,7 +3,7 @@
This documentation contains the API reference for the Dapr runtime.
Dapr is an open source runtime that provides a set of building blocks for building scalable distributed apps.
Building blocks include pub-sub, state management, bindings, messaging and invocation, actor runtime capabilities, and more.
Building blocks include pub/sub, state management, bindings, messaging and invocation, actor runtime capabilities, and more.
Dapr aims to provide an open, community driven approach to solving real world problems at scale.

View File

@ -123,4 +123,4 @@ A JSON encoded payload.
## Message Envelope
Dapr Pub-Sub adheres to version 0.3 of Cloud Events.
Dapr Pub/Sub adheres to version 0.3 of Cloud Events.