<?xml version="1.0" encoding="utf-8" standalone="yes"?><rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Bindings on Dapr 文档库</title><link>https://v1-18.docs.dapr.io/zh-hans/developing-applications/building-blocks/bindings/</link><description>Recent content in Bindings on Dapr 文档库</description><generator>Hugo</generator><language>zh-hans</language><atom:link href="https://v1-18.docs.dapr.io/zh-hans/developing-applications/building-blocks/bindings/index.xml" rel="self" type="application/rss+xml"/><item><title>bindings 概述</title><link>https://v1-18.docs.dapr.io/zh-hans/developing-applications/building-blocks/bindings/bindings-overview/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/developing-applications/building-blocks/bindings/bindings-overview/</guid><description>&lt;p>通过 Dapr 的 bindings API，您可以利用外部系统的事件来触发应用程序，并与外部系统交互。使用 bindings API，您可以：&lt;/p>
&lt;ul>
&lt;li>避免连接到消息系统并进行轮询的复杂性（如队列和消息总线）。&lt;/li>
&lt;li>专注于业务逻辑，而不是系统交互的实现细节。&lt;/li>
&lt;li>使您的代码不依赖于特定的 SDK 或库。&lt;/li>
&lt;li>处理重试和故障恢复。&lt;/li>
&lt;li>在运行时可以切换不同的 bindings。&lt;/li>
&lt;li>构建具有特定环境 bindings 设置的可移植应用程序，而无需更改代码。&lt;/li>
&lt;/ul>
&lt;p>例如，通过 bindings，您的应用程序可以响应传入的 Twilio/SMS 消息，而无需：&lt;/p>
&lt;ul>
&lt;li>添加或配置第三方 Twilio SDK&lt;/li>
&lt;li>担心从 Twilio 轮询（或使用 WebSockets 等）&lt;/li>
&lt;/ul>
&lt;img src="https://v1-18.docs.dapr.io/images/binding-overview.png" width=1000 alt="显示 bindings 的图示" style="padding-bottom:25px;">
&lt;p>在上图中：&lt;/p>
&lt;ul>
&lt;li>输入 binding 触发您应用程序上的一个方法。&lt;/li>
&lt;li>在组件上执行输出 binding 操作，例如 &lt;code>&amp;quot;create&amp;quot;&lt;/code>。&lt;/li>
&lt;/ul>
&lt;p>bindings 的开发独立于 Dapr 运行时。您可以&lt;a href="https://github.com/dapr/components-contrib/tree/master/bindings">查看并贡献 bindings&lt;/a>。&lt;/p>


&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">注意&lt;/h4>

 如果您正在使用 HTTP Binding，建议使用&lt;a href="https://v1-18.docs.dapr.io/zh-hans/reference/api/service_invocation_api/">service-invocation&lt;/a> 代替。阅读&lt;a href="https://v1-18.docs.dapr.io/zh-hans/developing-applications/building-blocks/service-invocation/howto-invoke-non-dapr-endpoints/">如何：使用 HTTP 调用非 Dapr 端点&lt;/a>以获取更多信息。

&lt;/div>

&lt;h2 id="输入-bindings">输入 bindings&lt;/h2>
&lt;p>通过输入 bindings，您可以在外部资源发生事件时触发您的应用程序。请求中可以发送可选的负载和元数据。&lt;/p>
&lt;p>&lt;a href="https://www.youtube.com/live/0y7ne6teHT4?si=wlmAi7BJBWS8KNK7&amp;amp;t=8261">以下概述视频和演示&lt;/a>展示了 Dapr 输入 binding 的工作原理。&lt;/p>
&lt;iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/0y7ne6teHT4?si=wlmAi7BJBWS8KNK7&amp;amp;start=8261" title="YouTube 视频播放器" style="padding-bottom:25px;" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen>&lt;/iframe> 
&lt;p>要接收来自输入 binding 的事件：&lt;/p></description></item><item><title>操作指南：使用输入绑定触发应用程序</title><link>https://v1-18.docs.dapr.io/zh-hans/developing-applications/building-blocks/bindings/howto-triggers/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/developing-applications/building-blocks/bindings/howto-triggers/</guid><description>&lt;p>当外部资源发生事件时，您可以通过输入绑定来触发您的应用程序。外部资源可以是队列、消息管道、云服务、文件系统等。请求中可以发送可选的负载和元数据。&lt;/p>
&lt;p>输入绑定非常适合用于事件驱动的处理、数据管道或一般的事件响应和后续处理。Dapr输入绑定允许您：&lt;/p>
&lt;ul>
&lt;li>在不需要特定SDK或库的情况下接收事件&lt;/li>
&lt;li>在不更改代码的情况下替换绑定&lt;/li>
&lt;li>专注于业务逻辑而不是事件资源的实现&lt;/li>
&lt;/ul>
&lt;img src="https://v1-18.docs.dapr.io/images/howto-triggers/kafka-input-binding.png" width=1000 alt="示例服务的绑定图示">
&lt;p>本指南使用Kafka绑定作为示例。您可以从&lt;a href="https://v1-18.docs.dapr.io/zh-hans/operations/components/setup-bindings/">绑定组件列表&lt;/a>中找到您偏好的绑定规范。在本指南中：&lt;/p>
&lt;ol>
&lt;li>示例调用&lt;code>/binding&lt;/code>端点，使用&lt;code>checkout&lt;/code>作为要调用的绑定名称。&lt;/li>
&lt;li>负载需要放在&lt;code>data&lt;/code>字段中，可以是任何可序列化为JSON的值。&lt;/li>
&lt;li>&lt;code>operation&lt;/code>字段指定绑定需要执行的操作。例如，&lt;a href="https://v1-18.docs.dapr.io/zh-hans/reference/components-reference/supported-bindings/kafka/#binding-support">Kafka绑定支持&lt;code>create&lt;/code>操作&lt;/a>。
&lt;ul>
&lt;li>您可以查看&lt;a href="https://v1-18.docs.dapr.io/zh-hans/reference/components-reference/supported-bindings/">每个输出绑定支持的操作（特定于每个组件）&lt;/a>。&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ol>


&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">注意&lt;/h4>

 如果您还没有尝试过，&lt;a href="https://v1-18.docs.dapr.io/zh-hans/getting-started/quickstarts/bindings-quickstart/">试试绑定快速入门&lt;/a>，快速了解如何使用绑定API。

&lt;/div>

&lt;h2 id="创建绑定">创建绑定&lt;/h2>
&lt;p>创建一个&lt;code>binding.yaml&lt;/code>文件，并保存到应用程序目录中的&lt;code>components&lt;/code>子文件夹中。&lt;/p>
&lt;p>创建一个名为&lt;code>checkout&lt;/code>的新绑定组件。在&lt;code>metadata&lt;/code>部分中，配置以下与Kafka相关的属性：&lt;/p>
&lt;ul>
&lt;li>您将发布消息的主题&lt;/li>
&lt;li>代理&lt;/li>
&lt;/ul>
&lt;p>在创建绑定组件时，&lt;a href="https://v1-18.docs.dapr.io/zh-hans/reference/api/bindings_api/#binding-direction-optional">指定绑定的支持&lt;code>direction&lt;/code>&lt;/a>。&lt;/p>






&lt;ul class="nav nav-tabs" id="tabs-5" role="tablist">
 &lt;li class="nav-item">
 &lt;button class="nav-link active"
 id="tabs-05-00-tab" data-bs-toggle="tab" data-bs-target="#tabs-05-00" role="tab"
 data-td-tp-persist="self-hosted (cli)" aria-controls="tabs-05-00" aria-selected="true">
 Self-Hosted (CLI)
 &lt;/button>
 &lt;/li>&lt;li class="nav-item">
 &lt;button class="nav-link"
 id="tabs-05-01-tab" data-bs-toggle="tab" data-bs-target="#tabs-05-01" role="tab"
 data-td-tp-persist="kubernetes" aria-controls="tabs-05-01" aria-selected="false">
 Kubernetes
 &lt;/button>
 &lt;/li>
&lt;/ul>

&lt;div class="tab-content" id="tabs-5-content">
 &lt;div class="tab-body tab-pane fade show active"
 id="tabs-05-00" role="tabpanel" aria-labelled-by="tabs-05-00-tab" tabindex="5">
 &lt;p>使用&lt;code>dapr run&lt;/code>命令的&lt;code>--resources-path&lt;/code>标志指向您的自定义资源目录。&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">apiVersion&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">dapr.io/v1alpha1&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">kind&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">Component&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">metadata&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">checkout&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">spec&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">type&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">bindings.kafka&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">version&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">v1&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">metadata&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#8f5902;font-style:italic"># Kafka代理连接设置&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">brokers&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">localhost:9092&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#8f5902;font-style:italic"># 消费者配置：主题和消费者组&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">topics&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">sample&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">consumerGroup&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">group1&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#8f5902;font-style:italic"># 发布者配置：主题&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">publishTopic&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">sample&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">authRequired&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">false&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">direction&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">input&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
 &lt;/div>
 &lt;div class="tab-body tab-pane fade"
 id="tabs-05-01" role="tabpanel" aria-labelled-by="tabs-05-01-tab" tabindex="5">
 &lt;p>要部署到Kubernetes集群中，运行&lt;code>kubectl apply -f binding.yaml&lt;/code>。&lt;/p></description></item><item><title>操作指南：使用输出绑定与外部资源交互</title><link>https://v1-18.docs.dapr.io/zh-hans/developing-applications/building-blocks/bindings/howto-bindings/</link><pubDate>Mon, 01 Jan 0001 00:00:00 +0000</pubDate><guid>https://v1-18.docs.dapr.io/zh-hans/developing-applications/building-blocks/bindings/howto-bindings/</guid><description>&lt;p>使用输出绑定，您可以与外部资源进行交互。在调用请求中，您可以发送可选的负载和元数据。&lt;/p>
&lt;img src="https://v1-18.docs.dapr.io/images/howto-bindings/kafka-output-binding.png" width=1000 alt="示例服务的绑定图示">
&lt;p>本指南以Kafka绑定为例。您可以从&lt;a href="https://v1-18.docs.dapr.io/zh-hans/operations/components/setup-bindings/">绑定组件列表&lt;/a>中选择您偏好的绑定规范。在本指南中：&lt;/p>
&lt;ol>
&lt;li>示例中调用了&lt;code>/binding&lt;/code>端点，使用&lt;code>checkout&lt;/code>作为要调用的绑定名称。&lt;/li>
&lt;li>负载放在必需的&lt;code>data&lt;/code>字段中，可以是任何JSON可序列化的值。&lt;/li>
&lt;li>&lt;code>operation&lt;/code>字段指定绑定需要执行的操作。例如，&lt;a href="https://v1-18.docs.dapr.io/zh-hans/reference/components-reference/supported-bindings/kafka/#binding-support">Kafka绑定支持&lt;code>create&lt;/code>操作&lt;/a>。
&lt;ul>
&lt;li>您可以查看&lt;a href="https://v1-18.docs.dapr.io/zh-hans/reference/components-reference/supported-bindings/">每个输出绑定支持的操作（特定于每个组件）&lt;/a>。&lt;/li>
&lt;/ul>
&lt;/li>
&lt;/ol>


&lt;div class="alert alert-primary" role="alert">
&lt;h4 class="alert-heading">注意&lt;/h4>

 如果您还没有尝试过，&lt;a href="https://v1-18.docs.dapr.io/zh-hans/getting-started/quickstarts/bindings-quickstart/">请尝试绑定快速入门&lt;/a>，以快速了解如何使用bindings API。

&lt;/div>

&lt;h2 id="创建绑定">创建绑定&lt;/h2>
&lt;p>创建一个&lt;code>binding.yaml&lt;/code>文件，并将其保存到应用程序目录中的&lt;code>components&lt;/code>子文件夹中。&lt;/p>
&lt;p>创建一个名为&lt;code>checkout&lt;/code>的新绑定组件。在&lt;code>metadata&lt;/code>部分中，配置以下与Kafka相关的属性：&lt;/p>
&lt;ul>
&lt;li>您将发布消息的主题&lt;/li>
&lt;li>代理&lt;/li>
&lt;/ul>
&lt;p>在创建绑定组件时，&lt;a href="https://v1-18.docs.dapr.io/zh-hans/reference/api/bindings_api/#binding-direction-optional">指定绑定的支持&lt;code>direction&lt;/code>&lt;/a>。&lt;/p>






&lt;ul class="nav nav-tabs" id="tabs-5" role="tablist">
 &lt;li class="nav-item">
 &lt;button class="nav-link active"
 id="tabs-05-00-tab" data-bs-toggle="tab" data-bs-target="#tabs-05-00" role="tab"
 data-td-tp-persist="self-hosted (cli)" aria-controls="tabs-05-00" aria-selected="true">
 Self-Hosted (CLI)
 &lt;/button>
 &lt;/li>&lt;li class="nav-item">
 &lt;button class="nav-link"
 id="tabs-05-01-tab" data-bs-toggle="tab" data-bs-target="#tabs-05-01" role="tab"
 data-td-tp-persist="kubernetes" aria-controls="tabs-05-01" aria-selected="false">
 Kubernetes
 &lt;/button>
 &lt;/li>
&lt;/ul>

&lt;div class="tab-content" id="tabs-5-content">
 &lt;div class="tab-body tab-pane fade show active"
 id="tabs-05-00" role="tabpanel" aria-labelled-by="tabs-05-00-tab" tabindex="5">
 &lt;p>使用&lt;code>dapr run&lt;/code>的&lt;code>--resources-path&lt;/code>标志指向您的自定义资源目录。&lt;/p>
&lt;div class="highlight">&lt;pre tabindex="0" style="background-color:#f8f8f8;-moz-tab-size:4;-o-tab-size:4;tab-size:4;">&lt;code class="language-yaml" data-lang="yaml">&lt;span style="display:flex;">&lt;span>&lt;span style="color:#204a87;font-weight:bold">apiVersion&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">dapr.io/v1alpha1&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">kind&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">Component&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">metadata&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">checkout&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline">&lt;/span>&lt;span style="color:#204a87;font-weight:bold">spec&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">type&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">bindings.kafka&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">version&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">v1&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">metadata&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#8f5902;font-style:italic"># Kafka代理连接设置&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">brokers&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">localhost:9092&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#8f5902;font-style:italic"># 消费者配置：主题和消费者组&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">topics&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">sample&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">consumerGroup&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">group1&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#8f5902;font-style:italic"># 发布者配置：主题&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">publishTopic&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">sample&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">authRequired&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">false&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>- &lt;span style="color:#204a87;font-weight:bold">name&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">direction&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;span style="display:flex;">&lt;span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#204a87;font-weight:bold">value&lt;/span>&lt;span style="color:#000;font-weight:bold">:&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline"> &lt;/span>&lt;span style="color:#000">output&lt;/span>&lt;span style="color:#f8f8f8;text-decoration:underline">
&lt;/span>&lt;/span>&lt;/span>&lt;/code>&lt;/pre>&lt;/div>
 &lt;/div>
 &lt;div class="tab-body tab-pane fade"
 id="tabs-05-01" role="tabpanel" aria-labelled-by="tabs-05-01-tab" tabindex="5">
 &lt;p>要将以下&lt;code>binding.yaml&lt;/code>文件部署到Kubernetes集群中，运行&lt;code>kubectl apply -f binding.yaml&lt;/code>。&lt;/p></description></item></channel></rss>