Azure Event Hubs 绑定规范
关于 Azure Event Hubs 组件绑定的详细文档
配置
要开始 Azure 事件中心绑定,需要创建一个类型为 bindings.azure.eventhubs
的组件。 请参阅本指南,了解如何创建和应用绑定配置。
参考此实例来创建一个事件中心。
apiVersion: dapr.io/v1alpha1
kind: Component
metadata:
name: <NAME>
namespace: <NAMESPACE>
spec:
type: bindings.azure.eventhubs
version: v1
metadata:
- name: connectionString # Azure EventHubs connection string
value: "Endpoint=sb://****"
- name: consumerGroup # EventHubs consumer group
value: "group1"
- name: storageAccountName # Azure Storage Account Name
value: "accountName"
- name: storageAccountKey # Azure Storage Account Key
value: "accountKey"
- name: storageContainerName # Azure Storage Container Name
value: "containerName"
- name: partitionID # (Optional) PartitionID to send and receive events
value: 0
Warning
以上示例将 Secret 明文存储。 更推荐的方式是使用 Secret 组件, 这里。
元数据字段规范
字段 | 必填 | 绑定支持 | 详情 | 示例 |
---|---|---|---|---|
connectionString | Y | Output | EventHubs 连接字符串。 请注意,这是 EventHubs 本身,而不是 EventHubs 名称空间。 确保使用子 EventHub 共享访问策略连接字符串 | “Endpoint=sb://**“ |
consumerGroup | Y | Output | The name of an EventHubs Consumer Group to listen on | “group1” |
storageAccountName | Y | Output | The name of the account of the Azure Storage account to persist checkpoints data on | “accountName” |
storageAccountKey | Y | Output | The account key for the Azure Storage account to persist checkpoints data on | “accountKey” |
storageContainerName | Y | Output | The name of the container in the Azure Storage account to persist checkpoints data on | “contianerName” |
partitionID | N | Output | ID of the partition to send and receive events | 0 |
绑定支持
该组件支持输出绑定,其操作如下:
create