操作:配置具有多个命名空间的 Pub/Sub 组件
多个命名空间下使用Dapr Pub/Sub
The documentation you are viewing is for Dapr v1.7 which is an older version of Dapr. For up-to-date documentation, see the latest version.
Dapr集成了pub/sub消息总线,为应用程序提供了创建事件驱动、松散耦合架构的能力,在这种架构下,生产者通过主题向消费者发送事件。
Dapr支持为每个应用配置多个命名的pub/sub组件。 每个pub/sub组件都有一个名称,这个名称在发布消息主题时使用。 Read the API reference for details on how to publish and subscribe to topics.
Pub/sub组件是可扩展的, A list of support pub/sub components is here and the implementations can be found in the components-contrib repo.
Pub/sub使用Component
文件来描述:
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: pubsub
namespace: default
spec:
type: pubsub.<NAME>
version: v1
metadata:
- name: <KEY>
value: <VALUE>
- name: <KEY>
value: <VALUE>
...
Pub/sub的类型由type
字段决定,连接地址和其他元数据等属性放在.metadata
部分。 Even though metadata values can contain secrets in plain text, it is recommended you use a secret store using a secretKeyRef
.
Visit this guide for instructions on configuring and using pub/sub components.
多个命名空间下使用Dapr Pub/Sub
Was this page helpful?
Glad to hear it! Please tell us how we can improve.
Sorry to hear that. Please tell us how we can improve.