Merge branch 'v1.16' into feature/exclude-meta-kafka

Signed-off-by: Patrick Assuied <patrick.assuied@elationhealth.com>
This commit is contained in:
Patrick Assuied 2025-07-21 11:38:46 -07:00 committed by GitHub
commit 1835703f19
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
476 changed files with 9404 additions and 6702 deletions

View File

@ -10,7 +10,7 @@
},
"ghcr.io/devcontainers/features/hugo:1": {
"extended": true,
"version": "0.100.2"
"version": "0.147.9"
},
"ghcr.io/devcontainers/features/node:1": {
"nodeGypDependencies": true,

View File

@ -3,11 +3,11 @@ Thank you for helping make the Dapr documentation better!
**Please follow this checklist before submitting:**
- [ ] Commits are signed with Developer Certificate of Origin (DCO - [learn more](https://docs.dapr.io/contributing/contributing-overview/#developer-certificate-of-origin-signing-your-work))
- [ ] [Read the contribution guide](https://docs.dapr.io/contributing/docs-contrib/contributing-docs/)
- [ ] Commands include options for Linux, MacOS, and Windows within codetabs
- [ ] Commands include options for Linux, MacOS, and Windows within tabpane
- [ ] New file and folder names are globally unique
- [ ] Page references use shortcodes instead of markdown or URL links
- [ ] Images use HTML style and have alternative text
- [ ] Places where multiple code/command options are given have codetabs
- [ ] Places where multiple code/command options are given have tabpane
In addition, please fill out the following to help reviewers understand this pull request:

108
.github/workflows/website-root.yml vendored Normal file
View File

@ -0,0 +1,108 @@
name: Azure Static Web App Root
on:
workflow_dispatch:
push:
branches:
- v1.15
pull_request:
types: [opened, synchronize, reopened, closed]
branches:
- v1.15
concurrency:
# Cancel the previously triggered build for only PR build.
group: website-${{ github.event.pull_request.number || github.sha }}
cancel-in-progress: true
jobs:
build_and_deploy_job:
name: Build Hugo Website
if: github.event.action != 'closed'
runs-on: ubuntu-latest
env:
SWA_BASE: 'proud-bay-0e9e0e81e'
HUGO_ENV: production
steps:
- name: Checkout docs repo
uses: actions/checkout@v4
with:
submodules: true
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3.0.0
with:
hugo-version: 0.147.9
extended: true
- name: Setup Submodules
run: |
cd daprdocs
git submodule update --init --recursive
cd ..
sudo npm install -D --save autoprefixer
sudo npm install -D --save postcss-cli
- name: Build Hugo Website
run: |
git config --global --add safe.directory /github/workspace
if [ $GITHUB_EVENT_NAME == 'pull_request' ]; then
STAGING_URL="https://${SWA_BASE}-${{github.event.number}}.westus2.azurestaticapps.net/"
fi
hugo ${STAGING_URL+-b "$STAGING_URL"}
- name: Deploy docs site
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_PROUD_BAY_0E9E0E81E }}
repo_token: ${{ secrets.GITHUB_TOKEN }}
action: "upload"
app_location: "/daprdocs/public/"
output_location: "/"
skip_app_build: true
skip_deploy_on_missing_secrets: true
- name: Upload Hugo artifacts
uses: actions/upload-artifact@v4
with:
name: hugo_build
path: ./daprdocs/public/
if-no-files-found: error
close_staging_site:
if: github.event_name == 'pull_request' && github.event.action == 'closed'
runs-on: ubuntu-latest
name: Close Pull Request Job
steps:
- name: Close Pull Request
id: closepullrequest
uses: Azure/static-web-apps-deploy@v1
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_API_TOKEN_PROUD_BAY_0E9E0E81E }}
action: "close"
skip_deploy_on_missing_secrets: true
algolia_index:
name: Index site for Algolia
if: github.event_name == 'push'
needs: ['build_and_deploy_job']
runs-on: ubuntu-latest
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_API_WRITE_KEY: ${{ secrets.ALGOLIA_API_WRITE_KEY }}
ALGOLIA_INDEX_NAME: daprdocs
steps:
- name: Checkout docs repo
uses: actions/checkout@v4
with:
submodules: false
- name: Download Hugo artifacts
uses: actions/download-artifact@v3
with:
name: hugo_build
path: site/
- name: Install Python packages
run: |
pip install --upgrade bs4
pip install --upgrade 'algoliasearch>=2.0,<3.0'
- name: Index site
run: python ./.github/scripts/algolia.py ./site

View File

@ -16,18 +16,36 @@ jobs:
runs-on: ubuntu-latest
name: Build and Deploy Job
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: recursive
fetch-depth: 0
- name: Setup Docsy
run: cd daprdocs && git submodule update --init --recursive && sudo npm install -D --save autoprefixer && sudo npm install -D --save postcss-cli
- name: Build And Deploy
- name: Setup Node
uses: actions/setup-node@v4
with:
node-version: '18'
- name: Setup Hugo
uses: peaceiris/actions-hugo@v3.0.0
with:
hugo-version: 0.147.9
extended: true
- name: Setup Submodules
run: |
cd daprdocs
git submodule update --init --recursive
cd ..
sudo npm install -D --save autoprefixer
sudo npm install -D --save postcss-cli
- name: Build Hugo Website
run: |
git config --global --add safe.directory /github/workspace
hugo
- name: Deploy Website
id: builddeploy
uses: Azure/static-web-apps-deploy@v1
env:
HUGO_ENV: production
HUGO_VERSION: "0.100.2"
HUGO_VERSION: "0.147.9"
with:
azure_static_web_apps_api_token: ${{ secrets.AZURE_STATIC_WEB_APPS_V1_16 }}
repo_token: ${{ secrets.GITHUB_TOKEN }} # Used for Github integrations (i.e. PR comments)
@ -35,10 +53,8 @@ jobs:
action: "upload"
###### Repository/Build Configurations - These values can be configured to match your app requirements. ######
# For more information regarding Static Web App workflow configurations, please visit: https://aka.ms/swaworkflowconfig
app_location: "/daprdocs" # App source code path
api_location: "api" # Api source code path - optional
output_location: "public" # Built app content directory - optional
app_build_command: "git config --global --add safe.directory /github/workspace && hugo"
app_location: "/daprdocs/public" # App source code path
output_location: "/" # Built app content directory - optional
###### End of Repository/Build Configurations ######
close_pull_request_job:

2
.gitignore vendored
View File

@ -3,6 +3,8 @@
.idea/
node_modules/
daprdocs/public
public
resources/_gen
daprdocs/resources/_gen
.venv/
.hugo_build.lock

3
.gitmodules vendored
View File

@ -1,6 +1,3 @@
[submodule "daprdocs/themes/docsy"]
path = daprdocs/themes/docsy
url = https://github.com/google/docsy.git
[submodule "sdkdocs/python"]
path = sdkdocs/python
url = https://github.com/dapr/python-sdk.git

9
.vscode/settings.json vendored Normal file
View File

@ -0,0 +1,9 @@
{
"cSpell.ignoreWords": [
"Dapr",
"tabpane"
],
"cSpell.words": [
"Dapr"
]
}

View File

@ -80,15 +80,16 @@ cd ./daprdocs
git submodule update --init --recursive
```
5. Install npm packages:
1. Navigate back to the repository root and install npm packages:
```sh
cd ..
npm install
```
## Run local server
1. Make sure you're in the `daprdocs` directory
1. Make sure you're in the root of the repository
2. Run
```sh

View File

@ -1,79 +0,0 @@
// Code formatting.
.highlight .copy-icon {
position: absolute;
right: 20px;
top: 18px;
opacity: 0.7;
}
.highlight pre {
/* Avoid pushing up the copy buttons. */
margin: 0;
}
.td-content {
// Highlighted code.
.highlight {
@extend .card;
margin: 0rem 0;
padding: 0rem;
margin-bottom: 2rem;
max-width: 100%;
border: none;
pre {
margin: 0;
padding: 1rem;
border-radius: 10px;
}
}
// Inline code
p code,
li>code,
table code {
color: inherit;
padding: 0.2em 0.4em;
margin: 0;
font-size: 85%;
word-break: normal;
background-color: rgba($black, 0.05);
border-radius: $border-radius;
br {
display: none;
}
}
// Code blocks
pre {
word-wrap: normal;
background-color: $gray-100;
padding: $spacer;
max-width: 100%;
>code {
background-color: inherit !important;
padding: 0;
margin: 0;
font-size: 100%;
word-break: normal;
white-space: pre;
border: 0;
}
}
pre.mermaid {
background-color: inherit;
font-size: 0;
}
}

View File

@ -12,6 +12,7 @@
> h1 {
font-weight: $font-weight-bold;
margin-bottom: .5rem;
color: $secondary;
}
> h2 {
@ -64,6 +65,27 @@
@extend .td-max-width-on-larger-screens;
}
a, a:visited {
color: $secondary;
text-decoration: none;
}
a:hover {
color: $primary;
text-decoration: none;;
}
.alert {
background-color: white;
border-color: $highlight2;
}
a.btn {
background-color: $highlight1;
text-decoration: none;
color: white;
}
.alert:not(:first-child) {
margin-top: 2 * $spacer;
margin-bottom: 2 * $spacer;
@ -73,6 +95,35 @@
margin-bottom: 1.5rem;
font-weight: $font-weight-bold;
}
.highlight i.fas {
// To prevent the margin change when doing mouseover.
display: inline !important;
}
.highlight {
margin: 0.5rem 0;
}
}
.text-white a, .text-white a:visited {
color: white;
text-decoration: none;
}
.text-white a:hover {
color: white;
text-decoration: underline;
}
.td-breadcrumbs a, .td-breadcrumbs a:visited {
color: $secondary;
text-decoration: none;
}
.td-breadcrumbs a:hover {
color: $primary;
text-decoration: none;
}
.td-title {
@ -82,4 +133,62 @@
@include media-breakpoint-up(sm) {
font-size: 3rem;
}
}
.card-deck {
display: flex;
flex-flow: row wrap;
margin-right: -15px;
margin-left: -15px;
}
.card {
flex: 1 0;
margin-right: 15px;
margin-bottom: 15px;
margin-left: 15px;
}
.card h5 {
color: $secondary;
}
.td-page-meta {
a, a:visited {
color: $secondary;
text-decoration: none;
}
a:hover {
color: $primary;
text-decoration: none;
}
}
nav#TableOfContents {
margin-top: 1.5em;
}
.tab-content {
max-width: 100% !important;
.tab-pane {
background-color: white !important;
max-width: 100% !important;
border-left: none !important;
border-right: none !important;
border-bottom: none !important;
}
}
.img-scarf {
height: 1px ;
width: 1px;
}
footer > .mx-sm-5 {
margin-left: auto !important;
margin-right: auto !important;
}

View File

@ -99,4 +99,8 @@
}
}
}
}
.navbar-expand {
justify-content: space-around;
}

View File

@ -1,161 +0,0 @@
//
// Left side navigation
//
.td-sidebar-nav {
padding-right: 0.5rem;
margin-right: -15px;
margin-left: -15px;
@include media-breakpoint-up(md) {
@supports (position: sticky) {
max-height: calc(100vh - 10rem);
overflow-y: auto;
}
}
@include media-breakpoint-up(md) {
display: block !important;
}
&__section {
li {
list-style: none;
}
ul {
padding: 0;
margin: 0;
}
@include media-breakpoint-up(md) {
& .ul-1 ul {
padding-left: 1.5em;
}
}
padding-left: 0;
}
&__section-title {
display: block;
font-weight: $font-weight-medium;
.active {
font-weight: $font-weight-bold;
}
a {
color: $gray-900;
}
}
.td-sidebar-link {
display: block;
padding-bottom: 0.375rem;
&__page {
color: $gray-700;
font-weight: $font-weight-light;
}
}
a {
&:hover {
color: $blue;
text-decoration: none;
}
&.active {
font-weight: $font-weight-bold;
}
}
.dropdown {
a {
color: $gray-700;
}
.nav-link {
padding: 0 0 1rem;
}
}
& > .td-sidebar-nav__section {
padding-top: .5rem;
padding-left: 1.5rem;
}
li i { // Layout of icons
padding-right: 0.5em;
&:before{
display: inline-block;
text-align: center;
min-width: 1em;
}
}
.td-sidebar-link.tree-root{
font-weight: $font-weight-bold;
color: $td-sidebar-tree-root-color;
margin-bottom: 1rem;
}
}
.td-sidebar {
@include media-breakpoint-up(md) {
padding-top: 4rem;
background-color: $td-sidebar-bg-color;
padding-right: 1rem;
border-right: 1px solid $td-sidebar-border-color;
}
padding-bottom: 1rem;
&__toggle {
line-height: 1;
color: $gray-900;
margin: 1rem;
}
&__search {
padding: 1rem 15px;
margin-right: -15px;
margin-left: -15px;
}
&__inner {
order: 0;
@include media-breakpoint-up(md) {
@supports (position: sticky) {
position: sticky;
top: 4rem;
z-index: 10;
height: calc(100vh - 6rem);
}
}
@include media-breakpoint-up(xl) {
flex: 0 1 320px;
}
.td-search-box {
width: 100%;
}
}
#content-desktop {display: block;}
#content-mobile {display: none;}
@include media-breakpoint-down(md) {
#content-desktop {display: none;}
#content-mobile {display: block;}
}
}

View File

@ -1,5 +1,12 @@
$primary:#0D2192;
$secondary: #1F329A;
$secondary: #3ea9f5;
$highlight1:#ff4e00;
$highlight2: #efca08;
// Sidebar colors
$td-sidebar-tree-root-color: $primary;
$td-sidebar-bg-color: #f8f9fa;
$td-sidebar-border-color: #dee2e6;
.navbar-brand {
text-align: left;

View File

@ -1,284 +0,0 @@
# Site Configuration
baseURL = "https://v1-16.docs.dapr.io"
title = "Dapr Docs"
theme = "docsy"
disableFastRender = true
enableRobotsTXT = true
enableGitInfo = true
# Language Configuration
languageCode = "en-us"
[languages]
[languages.en]
title = "Dapr Docs"
weight = 1
contentDir = "content/en"
languageName = "English"
[languages.zh-hans]
title = "Dapr 文档库"
weight = 2
contentDir = "content/zh-hans"
languageName = "简体中文"
# Disable categories & tags
disableKinds = ["taxonomy", "term"]
# Google Analytics
[services.googleAnalytics]
id = "G-60C6Q1ETC1"
# Mounts
[module]
[[module.mounts]]
source = "content/en"
target = "content"
lang = "en"
[[module.mounts]]
source = "static"
target = "static"
[[module.mounts]]
source = "layouts"
target = "layouts"
[[module.mounts]]
source = "data"
target = "data"
[[module.mounts]]
source = "assets"
target = "assets"
[[module.mounts]]
source = "archetypes"
target = "archetypes"
[[module.mounts]]
source = "../sdkdocs/python/daprdocs/content/en/python-sdk-docs"
target = "content/developing-applications/sdks/python"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/python/daprdocs/content/en/python-sdk-contributing"
target = "content/contributing/sdk-contrib/"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/php/daprdocs/content/en/php-sdk-docs"
target = "content/developing-applications/sdks/php"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/dotnet/daprdocs/content/en/dotnet-sdk-docs"
target = "content/developing-applications/sdks/dotnet"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/pluggable-components/dotnet/daprdocs/content/en/dotnet-sdk-docs"
target = "content/developing-applications/develop-components/pluggable-components/pluggable-components-sdks/pluggable-components-dotnet"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/pluggable-components/go/daprdocs/content/en/go-sdk-docs"
target = "content/developing-applications/develop-components/pluggable-components/pluggable-components-sdks/pluggable-components-go"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/dotnet/daprdocs/content/en/dotnet-sdk-contributing"
target = "content/contributing/sdk-contrib/"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/go/daprdocs/content/en/go-sdk-docs"
target = "content/developing-applications/sdks/go"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/go/daprdocs/content/en/go-sdk-contributing"
target = "content/contributing/sdk-contrib/"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/java/daprdocs/content/en/java-sdk-docs"
target = "content/developing-applications/sdks/java"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/java/daprdocs/content/en/java-sdk-contributing"
target = "content/contributing/sdk-contrib/"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/js/daprdocs/content/en/js-sdk-docs"
target = "content/developing-applications/sdks/js"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/js/daprdocs/content/en/js-sdk-contributing"
target = "content/contributing/sdk-contrib/"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/rust/daprdocs/content/en/rust-sdk-docs"
target = "content/developing-applications/sdks/rust"
lang = "en"
[[module.mounts]]
source = "../sdkdocs/rust/daprdocs/content/en/rust-sdk-contributing"
target = "content/contributing/sdk-contrib/"
lang = "en"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/docs"
target = "content"
lang = "zh-hans"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/contributing"
target = "content/contributing/sdk-contrib/"
lang = "zh-hans"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/sdks_python"
target = "content/developing-applications/sdks/python"
lang = "zh-hans"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/sdks_php"
target = "content/developing-applications/sdks/php"
lang = "zh-hans"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/sdks_dotnet"
target = "content/developing-applications/sdks/dotnet"
lang = "zh-hans"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/sdks_java"
target = "content/developing-applications/sdks/java"
lang = "zh-hans"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/sdks_go"
target = "content/developing-applications/sdks/go"
lang = "zh-hans"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/sdks_js"
target = "content/developing-applications/sdks/js"
lang = "zh-hans"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/sdks_rust"
target = "content/developing-applications/sdks/rust"
lang = "zh-hans"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/pluggable-components/dotnet"
target = "content/developing-applications/develop-components/pluggable-components/pluggable-components-sdks/pluggable-components-dotnet"
lang = "zh-hans"
[[module.mounts]]
source = "../translations/docs-zh/translated_content/zh_CN/pluggable-components/go"
target = "content/developing-applications/develop-components/pluggable-components/pluggable-components-sdks/pluggable-components-go"
lang = "zh-hans"
# Markdown Engine - Allow inline html
[markup]
[markup.goldmark]
[markup.goldmark.renderer]
unsafe = true
# Top Nav Bar
[[menu.main]]
name = "Homepage"
weight = 40
url = "https://dapr.io"
[[menu.main]]
name = "GitHub"
weight = 50
url = "https://github.com/dapr"
[[menu.main]]
name = "Blog"
weight = 60
url = "https://blog.dapr.io/posts"
[[menu.main]]
name = "Discord"
weight = 70
url = "https://aka.ms/dapr-discord"
[[menu.main]]
name = "Community"
weight = 80
url = "https://github.com/dapr/community/blob/master/README.md"
[params]
copyright = "The Dapr Authors"
distributed = "Documentation Distributed under [CC-BY-4.0](https://creativecommons.org/licenses/by/4.0/)"
trademark = "The Linux Foundation. All rights reserved. The Linux Foundation has registered trademarks and uses trademarks. For a list of trademarks of The Linux Foundation, please see our [Trademark Usage](https://linuxfoundation.org/trademark-usage/) page."
#privacy_policy = "https://policies.google.com/privacy"
# Algolia
algolia_docsearch = true
offlineSearch = false
# GitHub Information
github_repo = "https://github.com/dapr/docs"
github_project_repo = "https://github.com/dapr/dapr"
github_subdir = "daprdocs"
github_branch = "v1.16"
# Versioning
version_menu = "v1.16 (preview)"
version = "v1.16"
archived_version = false
url_latest_version = "https://docs.dapr.io"
[[params.versions]]
version = "v1.16 (preview)"
url = "#"
[[params.versions]]
version = "v1.15 (latest)"
url = "https://docs.dapr.io"
[[params.versions]]
version = "v1.14"
url = "https://v1-14.docs.dapr.io"
[[params.versions]]
version = "v1.13"
url = "https://v1-13.docs.dapr.io"
[[params.versions]]
version = "v1.12"
url = "https://v1-12.docs.dapr.io"
[[params.versions]]
version = "v1.11"
url = "https://v1-11.docs.dapr.io"
[[params.versions]]
version = "v1.10"
url = "https://v1-10.docs.dapr.io"
[[params.versions]]
version = "v1.9"
url = "https://v1-9.docs.dapr.io"
[[params.versions]]
version = "v1.8"
url = "https://v1-8.docs.dapr.io"
[[params.versions]]
version = "v1.7"
url = "https://v1-7.docs.dapr.io"
# UI Customization
[params.ui]
sidebar_menu_compact = true
navbar_logo = true
sidebar_search_disable = true
[params.ui.feedback]
enable = true
yes = '<b>Glad to hear it!</b> Please <a href="https://github.com/dapr/docs/issues/new/choose">tell us how we can improve</a>.'
no = '<b>Sorry to hear that.</b> Please <a href="https://github.com/dapr/docs/issues/new/choose">tell us how we can improve</a>.'
# Links
## End user relevant links. These will show up on left side of footer and in the community page if you have one.
[[params.links.user]]
name ="Twitter"
url = "https://twitter.com/daprdev"
icon = "fab fa-twitter"
desc = "Follow us on Twitter to get the latest updates!"
[[params.links.user]]
name = "YouTube"
url = "https://www.youtube.com/channel/UCtpSQ9BLB_3EXdWAUQYwnRA"
icon = "fab fa-youtube"
desc = "Community call recordings and other cool demos"
[[params.links.user]]
name = "Blog"
url = "https://blog.dapr.io/posts"
icon = "fas fa-blog"
desc = "Community call recordings and other cool demos"
## Developer relevant links. These will show up on right side of footer and in the community page if you have one.
[[params.links.developer]]
name = "GitHub"
url = "https://github.com/dapr/"
icon = "fab fa-github"
desc = "Development takes place here!"
[[params.links.developer]]
name = "Discord"
url = "https://aka.ms/dapr-discord"
icon = "fab fa-discord"
desc = "Conversations happen here!"
[[params.links.developer]]
name = "Zoom"
url = "https://aka.ms/dapr-community-call"
icon = "fas fa-video"
desc = "Meetings happen here!"

View File

@ -12,7 +12,7 @@ Dapr is a portable, event-driven runtime that makes it easy for any developer to
stateless and stateful applications that run on the cloud and edge and embraces the diversity of
languages and developer frameworks. Leveraging the benefits of a sidecar architecture, Dapr helps
you tackle the challenges that come with building microservices and keeps your code platform agnostic.
{{< button text="Get started" page="getting-started" >}}
{{< button text="Get started" page="getting-started.md" >}}
{{% /alert %}}
@ -23,21 +23,21 @@ you tackle the challenges that come with building microservices and keeps your c
<div class="card-body">
<h5 class="card-title"><b>Getting started</b></h5>
<p class="card-text">How to get up and running with Dapr in your environment in minutes.</p>
<a href="{{< ref getting-started >}}" class="stretched-link"></a>
<a href="{{% ref getting-started %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Quickstarts</b></h5>
<p class="card-text">A collection of tutorials with code samples to get you started quickly with Dapr.</p>
<a href="{{< ref quickstarts >}}" class="stretched-link"></a>
<a href="{{% ref quickstarts %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Concepts</b></h5>
<p class="card-text">Learn about Dapr, including its main features and capabilities.</p>
<a href="{{< ref concepts >}}" class="stretched-link"></a>
<a href="{{% ref concepts %}}" class="stretched-link"></a>
</div>
</div>
</div>
@ -50,21 +50,21 @@ you tackle the challenges that come with building microservices and keeps your c
<div class="card-body">
<h5 class="card-title"><b>Developing applications</b></h5>
<p class="card-text">Tools, tips, and information on how to build your application with Dapr.</p>
<a href="{{< ref developing-applications >}}" class="stretched-link"></a>
<a href="{{% ref developing-applications %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Building blocks</b></h5>
<p class="card-text">Capabilities that solve common development challenges for distributed applications.</p>
<a href="{{< ref building-blocks-concept >}}" class="stretched-link"></a>
<a href="{{% ref building-blocks-concept %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Operations</b></h5>
<p class="card-text">Hosting options, best-practices, and other guides and running your application on Dapr.</p>
<a href="{{< ref operations >}}" class="stretched-link"></a>
<a href="{{% ref operations %}}" class="stretched-link"></a>
</div>
</div>
</div>
@ -77,21 +77,21 @@ you tackle the challenges that come with building microservices and keeps your c
<div class="card-body">
<h5 class="card-title"><b>Reference</b></h5>
<p class="card-text">Detailed documentation on the Dapr API, CLI, bindings and more.</p>
<a href="{{< ref reference >}}" class="stretched-link"></a>
<a href="{{% ref reference %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Contributing</b></h5>
<p class="card-text">How to contribute to the Dapr project and the various repositories.</p>
<a href="{{< ref contributing >}}" class="stretched-link"></a>
<a href="{{% ref contributing %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
<div class="card-body">
<h5 class="card-title"><b>Roadmap</b></h5>
<p class="card-text">Learn about Dapr's roadmap and change process.</p>
<a href="{{< ref roadmap.md >}}" class="stretched-link"></a>
<a href="{{% ref roadmap.md %}}" class="stretched-link"></a>
</div>
</div>
</div>
@ -109,7 +109,7 @@ you tackle the challenges that come with building microservices and keeps your c
<p class="card-text">
Learn how to get up and running with Dapr in your preferred integrated development environment.
</p>
<a href="{{< ref ides >}}" class="stretched-link"></a>
<a href="{{% ref ides %}}" class="stretched-link"></a>
</div>
</div>
</div>
@ -124,7 +124,7 @@ you tackle the challenges that come with building microservices and keeps your c
<p class="card-text">
Create Dapr applications in your preferred language using the Dapr SDKs.
</p>
<a href="{{< ref sdks >}}" class="stretched-link"></a>
<a href="{{% ref sdks %}}" class="stretched-link"></a>
</div>
</div>
</div>
@ -139,7 +139,7 @@ you tackle the challenges that come with building microservices and keeps your c
<p class="card-text">
Learn more about the .NET SDK.
</p>
<a href="{{< ref dotnet >}}" class="stretched-link"></a>
<a href="{{% ref dotnet %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
@ -151,7 +151,7 @@ you tackle the challenges that come with building microservices and keeps your c
<p class="card-text">
Learn more about the Python SDK.
</p>
<a href="{{< ref python >}}" class="stretched-link"></a>
<a href="{{% ref python %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
@ -163,7 +163,7 @@ you tackle the challenges that come with building microservices and keeps your c
<p class="card-text">
Learn more about the JavaScript SDK.
</p>
<a href="{{< ref js >}}" class="stretched-link"></a>
<a href="{{% ref js %}}" class="stretched-link"></a>
</div>
</div>
</div>
@ -178,7 +178,7 @@ you tackle the challenges that come with building microservices and keeps your c
<p class="card-text">
Learn more about the Java SDK.
</p>
<a href="{{< ref java >}}" class="stretched-link"></a>
<a href="{{% ref java %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
@ -190,7 +190,7 @@ you tackle the challenges that come with building microservices and keeps your c
<p class="card-text">
Learn more about the Go SDK.
</p>
<a href="{{< ref go >}}" class="stretched-link"></a>
<a href="{{% ref go %}}" class="stretched-link"></a>
</div>
</div>
<div class="card">
@ -202,7 +202,7 @@ you tackle the challenges that come with building microservices and keeps your c
<p class="card-text">
Learn more about the PHP SDK.
</p>
<a href="{{< ref php >}}" class="stretched-link"></a>
<a href="{{% ref php %}}" class="stretched-link"></a>
</div>
</div>
</div>

View File

@ -11,6 +11,6 @@ Welcome to the Dapr concepts guide!
{{% alert title="Getting started with Dapr" color="primary" %}}
If you are ready to jump in and start developing with Dapr, please
visit the [getting started section]({{<ref getting-started>}}).
{{< button text="Install Dapr" page="getting-started" >}}
visit the [getting started section]({{%ref getting-started%}}).
{{< button text="Install Dapr" page="getting-started.md" >}}
{{% /alert %}}

View File

@ -6,7 +6,7 @@ weight: 200
description: "Modular best practices accessible over standard HTTP or gRPC APIs"
---
A [building block]({{< ref building-blocks >}}) is an HTTP or gRPC API that can be called from your code and uses one or more Dapr components. Dapr consists of a set of API building blocks, with extensibility to add new building blocks. Dapr's building blocks:
A [building block]({{% ref building-blocks %}}) is an HTTP or gRPC API that can be called from your code and uses one or more Dapr components. Dapr consists of a set of API building blocks, with extensibility to add new building blocks. Dapr's building blocks:
- Address common challenges in building resilient, microservices applications
- Codify best practices and patterns
@ -20,15 +20,15 @@ Dapr provides the following building blocks:
| Building Block | Endpoint | Description |
|----------------|----------|-------------|
| [**Service-to-service invocation**]({{< ref "service-invocation-overview.md" >}}) | `/v1.0/invoke` | Service invocation enables applications to communicate with each other through well-known endpoints in the form of http or gRPC messages. Dapr provides an endpoint that acts as a combination of a reverse proxy with built-in service discovery, while leveraging built-in distributed tracing and error handling.
| [**Publish and subscribe**]({{< ref "pubsub-overview.md" >}}) | `/v1.0/publish` `/v1.0/subscribe`| Pub/Sub is a loosely coupled messaging pattern where senders (or publishers) publish messages to a topic, to which subscribers subscribe. Dapr supports the pub/sub pattern between applications.
| [**Workflows**]({{< ref "workflow-overview.md" >}}) | `/v1.0/workflow` | The Workflow API enables you to define long running, persistent processes or data flows that span multiple microservices using Dapr workflows. The Workflow API can be combined with other Dapr API building blocks. For example, a workflow can call another service with service invocation or retrieve secrets, providing flexibility and portability.
| [**State management**]({{< ref "state-management-overview.md" >}}) | `/v1.0/state` | Application state is anything an application wants to preserve beyond a single session. Dapr provides a key/value-based state and query APIs with pluggable state stores for persistence.
| [**Bindings**]({{< ref "bindings-overview.md" >}}) | `/v1.0/bindings` | A binding provides a bi-directional connection to an external cloud/on-premise service or system. Dapr allows you to invoke the external service through the Dapr binding API, and it allows your application to be triggered by events sent by the connected service.
| [**Actors**]({{< ref "actors-overview.md" >}}) | `/v1.0/actors` | An actor is an isolated, independent unit of compute and state with single-threaded execution. Dapr provides an actor implementation based on the virtual actor pattern which provides a single-threaded programming model and where actors are garbage collected when not in use.
| [**Secrets**]({{< ref "secrets-overview.md" >}}) | `/v1.0/secrets` | Dapr provides a secrets building block API and integrates with secret stores such as public cloud stores, local stores and Kubernetes to store the secrets. Services can call the secrets API to retrieve secrets, for example to get a connection string to a database.
| [**Configuration**]({{< ref "configuration-api-overview.md" >}}) | `/v1.0/configuration` | The Configuration API enables you to retrieve and subscribe to application configuration items for supported configuration stores. This enables an application to retrieve specific configuration information, for example, at start up or when configuration changes are made in the store.
| [**Distributed lock**]({{< ref "distributed-lock-api-overview.md" >}}) | `/v1.0-alpha1/lock` | The distributed lock API enables you to take a lock on a resource so that multiple instances of an application can access the resource without conflicts and provide consistency guarantees.
| [**Cryptography**]({{< ref "cryptography-overview.md" >}}) | `/v1.0-alpha1/crypto` | The Cryptography API enables you to perform cryptographic operations, such as encrypting and decrypting messages, without exposing keys to your application.
| [**Jobs**]({{< ref "jobs-overview.md" >}}) | `/v1.0-alpha1/jobs` | The Jobs API enables you to schedule and orchestrate jobs. Example scenarios include: <ul><li>Schedule batch processing jobs to run every business day</li><li>Schedule various maintenance scripts to perform clean-ups</li><li>Schedule ETL jobs to run at specific times (hourly, daily) to fetch new data, process it, and update the data warehouse with the latest information.</li></ul>
| [**Conversation**]({{< ref "conversation-overview.md" >}}) | `/v1.0-alpha1/conversation` | The Conversation API enables you to supply prompts to converse with different large language models (LLMs) and includes features such as prompt caching and personally identifiable information (PII) obfuscation.
| [**Service-to-service invocation**]({{% ref "service-invocation-overview" %}}) | `/v1.0/invoke` | Service invocation enables applications to communicate with each other through well-known endpoints in the form of http or gRPC messages. Dapr provides an endpoint that acts as a combination of a reverse proxy with built-in service discovery, while leveraging built-in distributed tracing and error handling.
| [**Publish and subscribe**]({{% ref "pubsub-overview" %}}) | `/v1.0/publish` `/v1.0/subscribe`| Pub/Sub is a loosely coupled messaging pattern where senders (or publishers) publish messages to a topic, to which subscribers subscribe. Dapr supports the pub/sub pattern between applications.
| [**Workflows**]({{% ref "workflow-overview" %}}) | `/v1.0/workflow` | The Workflow API enables you to define long running, persistent processes or data flows that span multiple microservices using Dapr workflows. The Workflow API can be combined with other Dapr API building blocks. For example, a workflow can call another service with service invocation or retrieve secrets, providing flexibility and portability.
| [**State management**]({{% ref "state-management-overview" %}}) | `/v1.0/state` | Application state is anything an application wants to preserve beyond a single session. Dapr provides a key/value-based state and query APIs with pluggable state stores for persistence.
| [**Bindings**]({{% ref "bindings-overview" %}}) | `/v1.0/bindings` | A binding provides a bi-directional connection to an external cloud/on-premise service or system. Dapr allows you to invoke the external service through the Dapr binding API, and it allows your application to be triggered by events sent by the connected service.
| [**Actors**]({{% ref "actors-overview" %}}) | `/v1.0/actors` | An actor is an isolated, independent unit of compute and state with single-threaded execution. Dapr provides an actor implementation based on the virtual actor pattern which provides a single-threaded programming model and where actors are garbage collected when not in use.
| [**Secrets**]({{% ref "secrets-overview" %}}) | `/v1.0/secrets` | Dapr provides a secrets building block API and integrates with secret stores such as public cloud stores, local stores and Kubernetes to store the secrets. Services can call the secrets API to retrieve secrets, for example to get a connection string to a database.
| [**Configuration**]({{% ref "configuration-api-overview" %}}) | `/v1.0/configuration` | The Configuration API enables you to retrieve and subscribe to application configuration items for supported configuration stores. This enables an application to retrieve specific configuration information, for example, at start up or when configuration changes are made in the store.
| [**Distributed lock**]({{% ref "distributed-lock-api-overview" %}}) | `/v1.0-alpha1/lock` | The distributed lock API enables you to take a lock on a resource so that multiple instances of an application can access the resource without conflicts and provide consistency guarantees.
| [**Cryptography**]({{% ref "cryptography-overview" %}}) | `/v1.0-alpha1/crypto` | The Cryptography API enables you to perform cryptographic operations, such as encrypting and decrypting messages, without exposing keys to your application.
| [**Jobs**]({{% ref "jobs-overview" %}}) | `/v1.0-alpha1/jobs` | The Jobs API enables you to schedule and orchestrate jobs. Example scenarios include: <ul><li>Schedule batch processing jobs to run every business day</li><li>Schedule various maintenance scripts to perform clean-ups</li><li>Schedule ETL jobs to run at specific times (hourly, daily) to fetch new data, process it, and update the data warehouse with the latest information.</li></ul>
| [**Conversation**]({{% ref "conversation-overview" %}}) | `/v1.0-alpha1/conversation` | The Conversation API enables you to supply prompts to converse with different large language models (LLMs) and includes features such as prompt caching and personally identifiable information (PII) obfuscation.

View File

@ -11,11 +11,11 @@ Dapr uses a modular design where functionality is delivered as a component. Each
You can contribute implementations and extend Dapr's component interfaces capabilities via:
- The [components-contrib repository](https://github.com/dapr/components-contrib)
- [Pluggable components]({{< ref "components-concept.md#built-in-and-pluggable-components" >}}).
- [Pluggable components]({{% ref "components-concept#built-in-and-pluggable-components" %}}).
A building block can use any combination of components. For example, the [actors]({{< ref "actors-overview.md" >}}) and the [state management]({{< ref "state-management-overview.md" >}}) building blocks both use [state components](https://github.com/dapr/components-contrib/tree/master/state).
A building block can use any combination of components. For example, the [actors]({{% ref "actors-overview" %}}) and the [state management]({{% ref "state-management-overview" %}}) building blocks both use [state components](https://github.com/dapr/components-contrib/tree/master/state).
As another example, the [pub/sub]({{< ref "pubsub-overview.md" >}}) building block uses [pub/sub components](https://github.com/dapr/components-contrib/tree/master/pubsub).
As another example, the [pub/sub]({{% ref "pubsub-overview" %}}) building block uses [pub/sub components](https://github.com/dapr/components-contrib/tree/master/pubsub).
You can get a list of current components available in the hosting environment using the `dapr components` CLI command.
@ -30,9 +30,9 @@ Each component has a specification (or spec) that it conforms to. Components are
- A `components/local` folder within your solution, or
- Globally in the `.dapr` folder created when invoking `dapr init`.
These YAML files adhere to the generic [Dapr component schema]({{< ref "component-schema.md" >}}), but each is specific to the component specification.
These YAML files adhere to the generic [Dapr component schema]({{% ref "component-schema" %}}), but each is specific to the component specification.
It is important to understand that the component spec values, particularly the spec `metadata`, can change between components of the same component type, for example between different state stores, and that some design-time spec values can be overridden at runtime when making requests to a component's API. As a result, it is strongly recommended to review a [component's specs]({{< ref "components-reference" >}}), paying particular attention to the sample payloads for requests to set the metadata used to interact with the component.
It is important to understand that the component spec values, particularly the spec `metadata`, can change between components of the same component type, for example between different state stores, and that some design-time spec values can be overridden at runtime when making requests to a component's API. As a result, it is strongly recommended to review a [component's specs]({{% ref "components-reference" %}}), paying particular attention to the sample payloads for requests to set the metadata used to interact with the component.
The diagram below shows some examples of the components for each component type
<img src="/images/concepts-components.png" width=1200>
@ -50,11 +50,11 @@ For example:
- Your component may be specific to your company or pose IP concerns, so it cannot be included in the Dapr component repo.
- You want decouple your component updates from the Dapr release cycle.
For more information read [Pluggable components overview]({{< ref "pluggable-components-overview" >}})
For more information read [Pluggable components overview]({{% ref "pluggable-components-overview" %}})
## Hot Reloading
With the [`HotReload` feature enabled]({{< ref "support-preview-features.md" >}}), components are able to be "hot reloaded" at runtime.
With the [`HotReload` feature enabled]({{% ref "support-preview-features" %}}), components are able to be "hot reloaded" at runtime.
This means that you can update component configuration without restarting the Dapr runtime.
Component reloading occurs when a component resource is created, updated, or deleted, either in the Kubernetes API or in self-hosted mode when a file is changed in the `resources` directory.
When a component is updated, the component is first closed, and then reinitialized using the new configuration.
@ -66,74 +66,74 @@ The following are the component types provided by Dapr:
### Name resolution
Name resolution components are used with the [service invocation]({{< ref "service-invocation-overview.md" >}}) building block to integrate with the hosting environment and provide service-to-service discovery. For example, the Kubernetes name resolution component integrates with the Kubernetes DNS service, self-hosted uses mDNS and clusters of VMs can use the Consul name resolution component.
Name resolution components are used with the [service invocation]({{% ref "service-invocation-overview" %}}) building block to integrate with the hosting environment and provide service-to-service discovery. For example, the Kubernetes name resolution component integrates with the Kubernetes DNS service, self-hosted uses mDNS and clusters of VMs can use the Consul name resolution component.
- [List of name resolution components]({{< ref supported-name-resolution >}})
- [List of name resolution components]({{% ref supported-name-resolution %}})
- [Name resolution implementations](https://github.com/dapr/components-contrib/tree/master/nameresolution)
### Pub/sub brokers
Pub/sub broker components are message brokers that can pass messages to/from services as part of the [publish & subscribe]({{< ref pubsub-overview.md >}}) building block.
Pub/sub broker components are message brokers that can pass messages to/from services as part of the [publish & subscribe]({{% ref pubsub-overview %}}) building block.
- [List of pub/sub brokers]({{< ref supported-pubsub >}})
- [List of pub/sub brokers]({{% ref supported-pubsub %}})
- [Pub/sub broker implementations](https://github.com/dapr/components-contrib/tree/master/pubsub)
### State stores
State store components are data stores (databases, files, memory) that store key-value pairs as part of the [state management]({{< ref "state-management-overview.md" >}}) building block.
State store components are data stores (databases, files, memory) that store key-value pairs as part of the [state management]({{% ref "state-management-overview" %}}) building block.
- [List of state stores]({{< ref supported-state-stores >}})
- [List of state stores]({{% ref supported-state-stores %}})
- [State store implementations](https://github.com/dapr/components-contrib/tree/master/state)
### Bindings
External resources can connect to Dapr in order to trigger a method on an application or be called from an application as part of the [bindings]({{< ref bindings-overview.md >}}) building block.
External resources can connect to Dapr in order to trigger a method on an application or be called from an application as part of the [bindings]({{% ref bindings-overview %}}) building block.
- [List of supported bindings]({{< ref supported-bindings >}})
- [List of supported bindings]({{% ref supported-bindings %}})
- [Binding implementations](https://github.com/dapr/components-contrib/tree/master/bindings)
### Secret stores
A [secret]({{< ref "secrets-overview.md" >}}) is any piece of private information that you want to guard against unwanted access. Secrets stores are used to store secrets that can be retrieved and used in applications.
A [secret]({{% ref "secrets-overview" %}}) is any piece of private information that you want to guard against unwanted access. Secrets stores are used to store secrets that can be retrieved and used in applications.
- [List of supported secret stores]({{< ref supported-secret-stores >}})
- [List of supported secret stores]({{% ref supported-secret-stores %}})
- [Secret store implementations](https://github.com/dapr/components-contrib/tree/master/secretstores)
### Configuration stores
Configuration stores are used to save application data, which can then be read by application instances on startup or notified of when changes occur. This allows for dynamic configuration.
- [List of supported configuration stores]({{< ref supported-configuration-stores >}})
- [List of supported configuration stores]({{% ref supported-configuration-stores %}})
- [Configuration store implementations](https://github.com/dapr/components-contrib/tree/master/configuration)
### Locks
Lock components are used as a distributed lock to provide mutually exclusive access to a resource such as a queue or database.
- [List of supported locks]({{< ref supported-locks >}})
- [List of supported locks]({{% ref supported-locks %}})
- [Lock implementations](https://github.com/dapr/components-contrib/tree/master/lock)
### Cryptography
[Cryptography]({{< ref cryptography-overview.md >}}) components are used to perform cryptographic operations, including encrypting and decrypting messages, without exposing keys to your application.
[Cryptography]({{% ref cryptography-overview %}}) components are used to perform cryptographic operations, including encrypting and decrypting messages, without exposing keys to your application.
- [List of supported cryptography components]({{< ref supported-cryptography >}})
- [List of supported cryptography components]({{% ref supported-cryptography %}})
- [Cryptography implementations](https://github.com/dapr/components-contrib/tree/master/crypto)
### Conversation
Dapr provides developers a way to abstract interactions with large language models (LLMs) with built-in security and reliability features. Use [conversation]({{< ref conversation-overview.md >}}) components to send prompts to different LLMs, along with the conversation context.
Dapr provides developers a way to abstract interactions with large language models (LLMs) with built-in security and reliability features. Use [conversation]({{% ref conversation-overview %}}) components to send prompts to different LLMs, along with the conversation context.
- [List of supported conversation components]({{< ref supported-conversation >}})
- [List of supported conversation components]({{% ref supported-conversation %}})
- [Conversation implementations](https://github.com/dapr/components-contrib/tree/main/conversation)
### Middleware
Dapr allows custom [middleware]({{< ref "middleware.md" >}}) to be plugged into the HTTP request processing pipeline. Middleware can perform additional actions on an HTTP request (such as authentication, encryption, and message transformation) before the request is routed to the user code, or the response is returned to the client. The middleware components are used with the [service invocation]({{< ref "service-invocation-overview.md" >}}) building block.
Dapr allows custom [middleware]({{% ref "middleware" %}}) to be plugged into the HTTP request processing pipeline. Middleware can perform additional actions on an HTTP request (such as authentication, encryption, and message transformation) before the request is routed to the user code, or the response is returned to the client. The middleware components are used with the [service invocation]({{% ref "service-invocation-overview" %}}) building block.
- [List of supported middleware components]({{< ref supported-middleware >}})
- [List of supported middleware components]({{% ref supported-middleware %}})
- [Middleware implementations](https://github.com/dapr/components-contrib/tree/master/middleware)
{{% alert title="Note" color="primary" %}}
Since pluggable components are not required to be written in Go, they follow a different implementation process than built-in Dapr components. For more information on developing built-in components, read [developing new components](https://github.com/dapr/components-contrib/blob/master/docs/developing-component.md).
Since pluggable components are not required to be written in Go, they follow a different implementation process than built-in Dapr components. For more information on developing built-in components, read [developing new components](https://github.com/dapr/components-contrib/blob/master/docs/developing-component).
{{% /alert %}}

View File

@ -48,12 +48,12 @@ spec:
By default, there is a single configuration file called `daprsystem` installed with the Dapr control plane system services. This configuration file applies global control plane settings and is set up when Dapr is deployed to Kubernetes.
[Learn more about configuration options.]({{< ref "configuration-overview.md" >}})
[Learn more about configuration options.]({{% ref "configuration-overview" %}})
{{% alert title="Important" color="warning" %}}
Dapr application and control plane configurations should not be confused with the [configuration building block API]({{< ref configuration-api-overview >}}), which enables applications to retrieve key/value data from configuration store components.
Dapr application and control plane configurations should not be confused with the [configuration building block API]({{% ref configuration-api-overview %}}), which enables applications to retrieve key/value data from configuration store components.
{{% /alert %}}
## Next steps
{{< button text="Learn more about configuration" page="configuration-overview" >}}
{{< button text="Learn more about configuration" page="configuration-overview.md" >}}

View File

@ -5,11 +5,11 @@ linkTitle: "Operator"
description: "Overview of the Dapr operator service"
---
When running Dapr in [Kubernetes mode]({{< ref kubernetes >}}), a pod running the Dapr Operator service manages [Dapr component]({{< ref components >}}) updates and provides Kubernetes services endpoints for Dapr.
When running Dapr in [Kubernetes mode]({{% ref kubernetes %}}), a pod running the Dapr Operator service manages [Dapr component]({{% ref components %}}) updates and provides Kubernetes services endpoints for Dapr.
## Running the operator service
The operator service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{< ref kubernetes >}}).
The operator service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{% ref kubernetes %}}).
## Additional configuration options
@ -17,7 +17,7 @@ The operator service includes additional configuration options.
### Injector watchdog
The operator service includes an _injector watchdog_ feature which periodically polls all pods running in your Kubernetes cluster and confirms that the Dapr sidecar is injected in those which have the `dapr.io/enabled=true` annotation. It is primarily meant to address situations where the [Injector service]({{< ref sidecar-injector >}}) did not successfully inject the sidecar (the `daprd` container) into pods.
The operator service includes an _injector watchdog_ feature which periodically polls all pods running in your Kubernetes cluster and confirms that the Dapr sidecar is injected in those which have the `dapr.io/enabled=true` annotation. It is primarily meant to address situations where the [Injector service]({{% ref sidecar-injector %}}) did not successfully inject the sidecar (the `daprd` container) into pods.
The injector watchdog can be useful in a few situations, including:

View File

@ -5,24 +5,24 @@ linkTitle: "Placement"
description: "Overview of the Dapr Placement service"
---
The Dapr Placement service is used to calculate and distribute distributed hash tables for the location of [Dapr actors]({{< ref actors >}}) running in [self-hosted mode]({{< ref self-hosted >}}) or on [Kubernetes]({{< ref kubernetes >}}). Grouped by namespace, the hash tables map actor types to pods or processes so a Dapr application can communicate with the actor. Anytime a Dapr application activates a Dapr actor, the Placement service updates the hash tables with the latest actor location.
The Dapr Placement service is used to calculate and distribute distributed hash tables for the location of [Dapr actors]({{% ref actors %}}) running in [self-hosted mode]({{% ref self-hosted %}}) or on [Kubernetes]({{% ref kubernetes %}}). Grouped by namespace, the hash tables map actor types to pods or processes so a Dapr application can communicate with the actor. Anytime a Dapr application activates a Dapr actor, the Placement service updates the hash tables with the latest actor location.
## Self-hosted mode
The Placement service Docker container is started automatically as part of [`dapr init`]({{< ref self-hosted-with-docker.md >}}). It can also be run manually as a process if you are running in [slim-init mode]({{< ref self-hosted-no-docker.md >}}).
The Placement service Docker container is started automatically as part of [`dapr init`]({{% ref self-hosted-with-docker %}}). It can also be run manually as a process if you are running in [slim-init mode]({{% ref self-hosted-no-docker %}}).
## Kubernetes mode
The Placement service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. You can run Placement in high availability (HA) mode. [Learn more about setting HA mode in your Kubernetes service.]({{< ref "kubernetes-production.md#individual-service-ha-helm-configuration" >}})
The Placement service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. You can run Placement in high availability (HA) mode. [Learn more about setting HA mode in your Kubernetes service.]({{% ref "kubernetes-production#individual-service-ha-helm-configuration" %}})
For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{< ref kubernetes >}}).
For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{% ref kubernetes %}}).
## Placement tables
There is an [HTTP API `/placement/state` for Placement service]({{< ref placement_api.md >}}) that exposes placement table information. The API is exposed on the sidecar on the same port as the healthz. This is an unauthenticated endpoint, and is disabled by default. You need to set `DAPR_PLACEMENT_METADATA_ENABLED` environment or `metadata-enabled` command line args to true to enable it. If you are using helm you just need to set `dapr_placement.metadataEnabled` to true.
There is an [HTTP API `/placement/state` for Placement service]({{% ref placement_api %}}) that exposes placement table information. The API is exposed on the sidecar on the same port as the healthz. This is an unauthenticated endpoint, and is disabled by default. You need to set `DAPR_PLACEMENT_METADATA_ENABLED` environment or `metadata-enabled` command line args to true to enable it. If you are using helm you just need to set `dapr_placement.metadataEnabled` to true.
{{% alert title="Important" color="warning" %}}
When deploying actors into different namespaces ({{< ref namespaced-actors.md >}}), it is recommended to disable the `metadata-enabled` if you want to prevent retrieving actors from all namespaces. The metadata endpoint is scoped to all namespaces.
When deploying actors into different namespaces ({{% ref namespaced-actors %}}), it is recommended to disable the `metadata-enabled` if you want to prevent retrieving actors from all namespaces. The metadata endpoint is scoped to all namespaces.
{{% /alert %}}
### Usecase:
@ -95,4 +95,4 @@ updatedAt | timestamp | Timestamp of the actor registered/updated.
## Related links
[Learn more about the Placement API.]({{< ref placement_api.md >}})
[Learn more about the Placement API.]({{% ref placement_api %}})

View File

@ -5,7 +5,7 @@ linkTitle: "Scheduler"
description: "Overview of the Dapr scheduler service"
---
The Dapr Scheduler service is used to schedule different types of jobs, running in [self-hosted mode]({{< ref self-hosted >}}) or on [Kubernetes]({{< ref kubernetes >}}).
The Dapr Scheduler service is used to schedule different types of jobs, running in [self-hosted mode]({{% ref self-hosted %}}) or on [Kubernetes]({{% ref kubernetes %}}).
- Jobs created through the Jobs API
- Actor reminder jobs (used by the actor reminders)
- Actor reminder jobs created by the Workflow API (which uses actor reminders)
@ -20,7 +20,7 @@ The diagram below shows how the Scheduler service is used via the jobs API when
## Actor Reminders
Prior to Dapr v1.15, [actor reminders]({{< ref "actors-timers-reminders.md#actor-reminders" >}}) were run using the Placement service. Now, by default, the [`SchedulerReminders` feature flag]({{< ref "support-preview-features.md#current-preview-features" >}}) is set to `true`, and all new actor reminders you create are run using the Scheduler service to make them more scalable.
Prior to Dapr v1.15, [actor reminders]({{% ref "actors-timers-reminders#actor-reminders" %}}) were run using the Placement service. Now, by default, the [`SchedulerReminders` feature flag]({{% ref "support-preview-features#current-preview-features" %}}) is set to `true`, and all new actor reminders you create are run using the Scheduler service to make them more scalable.
When you deploy Dapr v1.15, any _existing_ actor reminders are automatically migrated from the Actor State Store to the Scheduler service as a one time operation for each actor type. Each replica will only migrate the reminders whose actor type and id are associated with that host. This means that only when all replicas implementing an actor type are upgraded to 1.15, will all the reminders associated with that type be migrated. There will be _no_ loss of reminder triggers during the migration. However, you can prevent this migration and keep the existing actor reminders running using the Actor State Store by setting the `SchedulerReminders` flag to `false` in the application configuration file for the actor type.
@ -63,13 +63,13 @@ For non-client side errors, for example, when a job cannot be sent to an availab
## Self-hosted mode
The Scheduler service Docker container is started automatically as part of `dapr init`. It can also be run manually as a process if you are running in [slim-init mode]({{< ref self-hosted-no-docker.md >}}).
The Scheduler service Docker container is started automatically as part of `dapr init`. It can also be run manually as a process if you are running in [slim-init mode]({{% ref self-hosted-no-docker %}}).
The Scheduler can be run in both high availability (HA) and non-HA modes in self-hosted deployments. However, non-HA mode is not recommended for production use. If switching between non-HA and HA modes, the existing data directory must be removed, which results in loss of jobs and actor reminders. [Run a back-up]({{< ref "#back-up-and-restore-scheduler-data" >}}) before making this change to avoid losing data.
The Scheduler can be run in both high availability (HA) and non-HA modes in self-hosted deployments. However, non-HA mode is not recommended for production use. If switching between non-HA and HA modes, the existing data directory must be removed, which results in loss of jobs and actor reminders. [Run a back-up]({{% ref "#back-up-and-restore-scheduler-data" %}}) before making this change to avoid losing data.
## Kubernetes mode
The Scheduler service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. Scheduler always runs in high availability (HA) mode in Kubernetes deployments. Scaling the Scheduler service replicas up or down is not possible without incurring data loss due to the nature of the embedded data store. [Learn more about setting HA mode in your Kubernetes service.]({{< ref "kubernetes-production.md#individual-service-ha-helm-configuration" >}})
The Scheduler service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. Scheduler always runs in high availability (HA) mode in Kubernetes deployments. Scaling the Scheduler service replicas up or down is not possible without incurring data loss due to the nature of the embedded data store. [Learn more about setting HA mode in your Kubernetes service.]({{% ref "kubernetes-production#individual-service-ha-helm-configuration" %}})
When a Kubernetes namespace is deleted, all the Job and Actor Reminders corresponding to that namespace are deleted.
@ -127,14 +127,14 @@ Port forward the Scheduler instance and view etcd's metrics with the following:
curl -s http://localhost:2379/metrics
```
Fine tune the embedded etcd to your needs by [reviewing and configuring the Scheduler's etcd flags as needed](https://github.com/dapr/dapr/blob/master/charts/dapr/README.md#dapr-scheduler-options).
Fine tune the embedded etcd to your needs by [reviewing and configuring the Scheduler's etcd flags as needed](https://github.com/dapr/dapr/blob/master/charts/dapr/README#dapr-scheduler-options).
## Disabling the Scheduler service
If you are not using any features that require the Scheduler service (Jobs API, Actor Reminders, or Workflows), you can disable it by setting `global.scheduler.enabled=false`.
For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{< ref kubernetes >}}).
For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{% ref kubernetes %}}).
## Related links
[Learn more about the Jobs API.]({{< ref jobs_api.md >}})
[Learn more about the Jobs API.]({{% ref jobs_api %}})

View File

@ -5,25 +5,25 @@ linkTitle: "Sentry"
description: "Overview of the Dapr sentry service"
---
The Dapr Sentry service manages mTLS between services and acts as a certificate authority. It generates mTLS certificates and distributes them to any running sidecars. This allows sidecars to communicate with encrypted, mTLS traffic. For more information read the [sidecar-to-sidecar communication overview]({{< ref "security-concept.md#sidecar-to-sidecar-communication" >}}).
The Dapr Sentry service manages mTLS between services and acts as a certificate authority. It generates mTLS certificates and distributes them to any running sidecars. This allows sidecars to communicate with encrypted, mTLS traffic. For more information read the [sidecar-to-sidecar communication overview]({{% ref "security-concept#sidecar-to-sidecar-communication" %}}).
## Self-hosted mode
The Sentry service Docker container is not started automatically as part of [`dapr init`]({{< ref self-hosted-with-docker.md >}}). However it can be executed manually by following the instructions for setting up [mutual TLS]({{< ref "mtls.md#self-hosted" >}}).
The Sentry service Docker container is not started automatically as part of [`dapr init`]({{% ref self-hosted-with-docker %}}). However it can be executed manually by following the instructions for setting up [mutual TLS]({{% ref "mtls#self-hosted" %}}).
It can also be run manually as a process if you are running in [slim-init mode]({{< ref self-hosted-no-docker.md >}}).
It can also be run manually as a process if you are running in [slim-init mode]({{% ref self-hosted-no-docker %}}).
<img src="/images/security-mTLS-sentry-selfhosted.png" width=1000>
## Kubernetes mode
The sentry service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{< ref kubernetes >}}).
The sentry service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{% ref kubernetes %}}).
<img src="/images/security-mTLS-sentry-kubernetes.png" width=1000>
## Further reading
- [Security overview]({{< ref security-concept.md >}})
- [Self-hosted mode]({{< ref self-hosted-with-docker.md >}})
- [Kubernetes mode]({{< ref kubernetes >}})
- [Security overview]({{% ref security-concept %}})
- [Self-hosted mode]({{% ref self-hosted-with-docker %}})
- [Kubernetes mode]({{% ref kubernetes %}})

View File

@ -5,9 +5,9 @@ linkTitle: "Sidecar injector"
description: "Overview of the Dapr sidecar injector process"
---
When running Dapr in [Kubernetes mode]({{< ref kubernetes >}}), a pod is created running the Dapr Sidecar Injector service, which looks for pods initialized with the [Dapr annotations]({{< ref arguments-annotations-overview.md >}}), and then creates another container in that pod for the [daprd service]({{< ref sidecar >}})
When running Dapr in [Kubernetes mode]({{% ref kubernetes %}}), a pod is created running the Dapr Sidecar Injector service, which looks for pods initialized with the [Dapr annotations]({{% ref arguments-annotations-overview %}}), and then creates another container in that pod for the [daprd service]({{% ref sidecar %}})
## Running the sidecar injector
The sidecar injector service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{< ref kubernetes >}}).
The sidecar injector service is deployed as part of `dapr init -k`, or via the Dapr Helm charts. For more information on running Dapr on Kubernetes, visit the [Kubernetes hosting page]({{% ref kubernetes %}}).

View File

@ -6,13 +6,13 @@ weight: 100
description: "Overview of the Dapr sidecar process"
---
Dapr uses a [sidecar pattern]({{< ref "concepts/overview.md#sidecar-architecture" >}}), meaning the Dapr APIs are run and exposed on a separate process, the Dapr sidecar, running alongside your application. The Dapr sidecar process is named `daprd` and is launched in different ways depending on the hosting environment.
Dapr uses a [sidecar pattern]({{% ref "overview#sidecar-architecture" %}}), meaning the Dapr APIs are run and exposed on a separate process, the Dapr sidecar, running alongside your application. The Dapr sidecar process is named `daprd` and is launched in different ways depending on the hosting environment.
The Dapr sidecar exposes:
- [Building block APIs]({{<ref building-blocks-concept>}}) used by your application business logic
- A [metadata API]({{<ref metadata_api>}}) for discoverability of capabilities and to set attributes
- A [health API]({{<ref sidecar-health>}}) to determine health status and sidecar readiness and liveness
- [Building block APIs]({{% ref building-blocks-concept%}}) used by your application business logic
- A [metadata API]({{% ref metadata_api%}}) for discoverability of capabilities and to set attributes
- A [health API]({{% ref sidecar-health%}}) to determine health status and sidecar readiness and liveness
The Dapr sidecar will reach readiness state once the application is accessible on its configured port. The application cannot access the Dapr components during application start up/initialization.
@ -23,21 +23,21 @@ The sidecar APIs are called from your application over local http or gRPC endpoi
## Self-hosted with `dapr run`
When Dapr is installed in [self-hosted mode]({{<ref self-hosted>}}), the `daprd` binary is downloaded and placed under the user home directory (`$HOME/.dapr/bin` for Linux/macOS or `%USERPROFILE%\.dapr\bin\` for Windows).
When Dapr is installed in [self-hosted mode]({{% ref self-hosted%}}), the `daprd` binary is downloaded and placed under the user home directory (`$HOME/.dapr/bin` for Linux/macOS or `%USERPROFILE%\.dapr\bin\` for Windows).
In self-hosted mode, running the Dapr CLI [`run` command]({{< ref dapr-run.md >}}) launches the `daprd` executable with the provided application executable. This is the recommended way of running the Dapr sidecar when working locally in scenarios such as development and testing.
In self-hosted mode, running the Dapr CLI [`run` command]({{% ref dapr-run %}}) launches the `daprd` executable with the provided application executable. This is the recommended way of running the Dapr sidecar when working locally in scenarios such as development and testing.
You can find the various arguments that the CLI exposes to configure the sidecar in the [Dapr run command reference]({{<ref dapr-run>}}).
You can find the various arguments that the CLI exposes to configure the sidecar in the [Dapr run command reference]({{% ref dapr-run%}}).
## Kubernetes with `dapr-sidecar-injector`
On [Kubernetes]({{< ref kubernetes.md >}}), the Dapr control plane includes the [dapr-sidecar-injector service]({{< ref kubernetes-overview.md >}}), which watches for new pods with the `dapr.io/enabled` annotation and injects a container with the `daprd` process within the pod. In this case, sidecar arguments can be passed through annotations as outlined in the **Kubernetes annotations** column in [this table]({{<ref arguments-annotations-overview>}}).
On [Kubernetes]({{% ref kubernetes %}}), the Dapr control plane includes the [dapr-sidecar-injector service]({{% ref kubernetes-overview %}}), which watches for new pods with the `dapr.io/enabled` annotation and injects a container with the `daprd` process within the pod. In this case, sidecar arguments can be passed through annotations as outlined in the **Kubernetes annotations** column in [this table]({{% ref arguments-annotations-overview%}}).
## Running the sidecar directly
In most cases you do not need to run `daprd` explicitly, as the sidecar is either launched by the [CLI]({{<ref cli-overview>}}) (self-hosted mode) or by the dapr-sidecar-injector service (Kubernetes). For advanced use cases (debugging, scripted deployments, etc.) the `daprd` process can be launched directly.
In most cases you do not need to run `daprd` explicitly, as the sidecar is either launched by the [CLI]({{% ref cli-overview%}}) (self-hosted mode) or by the dapr-sidecar-injector service (Kubernetes). For advanced use cases (debugging, scripted deployments, etc.) the `daprd` process can be launched directly.
For a detailed list of all available arguments run `daprd --help` or see this [table]({{< ref arguments-annotations-overview.md >}}) which outlines how the `daprd` arguments relate to the CLI arguments and Kubernetes annotations.
For a detailed list of all available arguments run `daprd --help` or see this [table]({{% ref arguments-annotations-overview %}}) which outlines how the `daprd` arguments relate to the CLI arguments and Kubernetes annotations.
### Examples

View File

@ -7,17 +7,17 @@ description: "Common questions asked about Dapr"
---
## How does Dapr compare to service meshes such as Istio, Linkerd or OSM?
Dapr is not a service mesh. While service meshes focus on fine-grained network control, Dapr is focused on helping developers build distributed applications. Both Dapr and service meshes use the sidecar pattern and run alongside the application. They do have some overlapping features, but also offer unique benefits. For more information please read the [Dapr & service meshes]({{<ref service-mesh>}}) concept page.
Dapr is not a service mesh. While service meshes focus on fine-grained network control, Dapr is focused on helping developers build distributed applications. Both Dapr and service meshes use the sidecar pattern and run alongside the application. They do have some overlapping features, but also offer unique benefits. For more information please read the [Dapr & service meshes]({{%ref service-mesh%}}) concept page.
## Performance Benchmarks
The Dapr project is focused on performance due to the inherent discussion of Dapr being a sidecar to your application. See [here]({{< ref perf-service-invocation.md >}}) for updated performance numbers.
The Dapr project is focused on performance due to the inherent discussion of Dapr being a sidecar to your application. See [here]({{% ref perf-service-invocation %}}) for updated performance numbers.
## Actors
### What is the relationship between Dapr, Orleans and Service Fabric Reliable Actors?
The actors in Dapr are based on the same virtual actor concept that [Orleans](https://www.microsoft.com/research/project/orleans-virtual-actors/) started, meaning that they are activated when called and deactivated after a period of time. If you are familiar with Orleans, Dapr C# actors will be familiar. Dapr C# actors are based on [Service Fabric Reliable Actors](https://docs.microsoft.com/azure/service-fabric/service-fabric-reliable-actors-introduction) (which also came from Orleans) and enable you to take Reliable Actors in Service Fabric and migrate them to other hosting platforms such as Kubernetes or other on-premises environments.
Moreover, Dapr is about more than just actors. It provides you with a set of best-practice building blocks to build into any microservices application. See [Dapr overview]({{< ref overview.md >}}).
Moreover, Dapr is about more than just actors. It provides you with a set of best-practice building blocks to build into any microservices application. See [Dapr overview]({{% ref overview %}}).
### Differences between Dapr and an actor framework
@ -29,7 +29,7 @@ The Dapr runtime SDKs have language-specific actor frameworks. For example, the
## Does Dapr have any SDKs I can use if I want to work with a particular programming language or framework?
To make using Dapr more natural for different languages, it includes [language specific SDKs]({{<ref sdks>}}) for Go, Java, JavaScript, .NET, Python, PHP, Rust and C++. These SDKs expose the functionality in the Dapr building blocks, such as saving state, publishing an event or creating an actor, through a typed language API rather than calling the http/gRPC API. This enables you to write a combination of stateless and stateful functions and actors all in the language of your choice. And because these SDKs share the Dapr runtime, you get cross-language actor and functions support.
To make using Dapr more natural for different languages, it includes [language specific SDKs]({{%ref sdks%}}) for Go, Java, JavaScript, .NET, Python, PHP, Rust and C++. These SDKs expose the functionality in the Dapr building blocks, such as saving state, publishing an event or creating an actor, through a typed language API rather than calling the http/gRPC API. This enables you to write a combination of stateless and stateful functions and actors all in the language of your choice. And because these SDKs share the Dapr runtime, you get cross-language actor and functions support.
## What frameworks does Dapr integrate with?
Dapr can be integrated with any developer framework. For example, in the Dapr .NET SDK you can find ASP.NET Core integration, which brings stateful routing controllers that respond to pub/sub events from other services.

View File

@ -12,15 +12,15 @@ Dapr supports namespacing in service invocation calls between applications, when
To get started, create and configure your namespace.
{{< tabs "Self-Hosted" "Kubernetes">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab header="Self-Hosted" %}}
In self-hosted mode, specify the namespace for a Dapr instance by setting the `NAMESPACE` environment variable.
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab header="Kubernetes" %}}
On Kubernetes, create and configure the namespace:
@ -31,15 +31,14 @@ kubectl config set-context --current --namespace=namespaceA
Then deploy your applications into this namespace.
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
Learn how to use namespacing throughout Dapr:
- [Service Invocation namespaces]({{< ref service-invocation-namespaces.md >}})
- [How to: Set up pub/sub namespace consumer groups]({{< ref howto-namespace.md >}})
- [Service Invocation namespaces]({{% ref service-invocation-namespaces %}})
- [How to: Set up pub/sub namespace consumer groups]({{% ref howto-namespace %}})
- Components:
- [How to: Configure pub/sub components with multiple namespaces]({{< ref pubsub-namespaces.md >}})
- [Scope components to one or more applications]({{< ref component-scopes.md >}})
- [Namespaced actors]({{< ref namespaced-actors.md >}})
- [How to: Configure pub/sub components with multiple namespaces]({{% ref pubsub-namespaces %}})
- [Scope components to one or more applications]({{% ref component-scopes %}})

View File

@ -27,17 +27,17 @@ Maintaining this instrumentation code, which is not part of the core logic of th
## Observability for your application with Dapr
When you leverage Dapr API building blocks to perform service-to-service calls, pub/sub messaging, and other APIs, Dapr offers an advantage with respect to [distributed tracing]({{< ref tracing >}}). Since this inter-service communication flows through the Dapr runtime (or "sidecar"), Dapr is in a unique position to offload the burden of application-level instrumentation.
When you leverage Dapr API building blocks to perform service-to-service calls, pub/sub messaging, and other APIs, Dapr offers an advantage with respect to [distributed tracing]({{% ref tracing %}}). Since this inter-service communication flows through the Dapr runtime (or "sidecar"), Dapr is in a unique position to offload the burden of application-level instrumentation.
### Distributed tracing
Dapr can be [configured to emit tracing data]({{< ref setup-tracing.md >}}) using the widely adopted protocols of [Open Telemetry (OTEL)](https://opentelemetry.io/) and [Zipkin](https://zipkin.io). This makes it easily integrated with multiple observability tools.
Dapr can be [configured to emit tracing data]({{% ref setup-tracing %}}) using the widely adopted protocols of [Open Telemetry (OTEL)](https://opentelemetry.io/) and [Zipkin](https://zipkin.io). This makes it easily integrated with multiple observability tools.
<img src="/images/observability-tracing.png" width=1000 alt="Distributed tracing with Dapr">
### Automatic tracing context generation
Dapr uses the [W3C tracing]({{< ref tracing >}}) specification for tracing context, included as part Open Telemetry (OTEL), to generate and propagate the context header for the application or propagate user-provided context headers. This means that you get tracing by default with Dapr.
Dapr uses the [W3C tracing]({{% ref tracing %}}) specification for tracing context, included as part Open Telemetry (OTEL), to generate and propagate the context header for the application or propagate user-provided context headers. This means that you get tracing by default with Dapr.
## Observability for the Dapr sidecar and control plane
@ -50,25 +50,25 @@ You can also observe Dapr itself, by:
### Logging
Dapr generates [logs]({{< ref logs.md >}}) to:
Dapr generates [logs]({{% ref logs %}}) to:
- Provide visibility into sidecar operation
- Help users identify issues and perform debugging
Log events contain warning, error, info, and debug messages produced by Dapr system services. You can also configure Dapr to send logs to collectors, such as [Open Telemetry Collector]({{< ref otel-collector >}}), [Fluentd]({{< ref fluentd.md >}}), [New Relic]({{< ref "operations/observability/logging/newrelic.md" >}}), [Azure Monitor]({{< ref azure-monitor.md >}}), and other observability tools, so that logs can be searched and analyzed to provide insights.
Log events contain warning, error, info, and debug messages produced by Dapr system services. You can also configure Dapr to send logs to collectors, such as [Open Telemetry Collector]({{% ref otel-collector %}}), [Fluentd]({{% ref fluentd %}}), [New Relic]({{% ref "operations/observability/logging/newrelic.md" %}}), [Azure Monitor]({{% ref azure-monitor %}}), and other observability tools, so that logs can be searched and analyzed to provide insights.
### Metrics
Metrics are a series of measured values and counts collected and stored over time. [Dapr metrics]({{< ref metrics >}}) provide monitoring capabilities to understand the behavior of the Dapr sidecar and control plane. For example, the metrics between a Dapr sidecar and the user application show call latency, traffic failures, error rates of requests, etc.
Metrics are a series of measured values and counts collected and stored over time. [Dapr metrics]({{% ref metrics %}}) provide monitoring capabilities to understand the behavior of the Dapr sidecar and control plane. For example, the metrics between a Dapr sidecar and the user application show call latency, traffic failures, error rates of requests, etc.
Dapr [control plane metrics](https://github.com/dapr/dapr/blob/master/docs/development/dapr-metrics.md) show sidecar injection failures and the health of control plane services, including CPU usage, number of actor placements made, etc.
Dapr [control plane metrics](https://github.com/dapr/dapr/blob/master/docs/development/dapr-metrics) show sidecar injection failures and the health of control plane services, including CPU usage, number of actor placements made, etc.
### Health checks
The Dapr sidecar exposes an HTTP endpoint for [health checks]({{< ref sidecar-health.md >}}). With this API, user code or hosting environments can probe the Dapr sidecar to determine its status and identify issues with sidecar readiness.
The Dapr sidecar exposes an HTTP endpoint for [health checks]({{% ref sidecar-health %}}). With this API, user code or hosting environments can probe the Dapr sidecar to determine its status and identify issues with sidecar readiness.
Conversely, Dapr can be configured to probe for the [health of your application]({{< ref app-health.md >}}), and react to changes in the app's health, including stopping pub/sub subscriptions and short-circuiting service invocation calls.
Conversely, Dapr can be configured to probe for the [health of your application]({{% ref app-health %}}), and react to changes in the app's health, including stopping pub/sub subscriptions and short-circuiting service invocation calls.
## Next steps
- [Learn more about observability in developing with Dapr]({{< ref tracing >}})
- [Learn more about observability in operating with Dapr]({{< ref tracing >}})
- [Learn more about observability in developing with Dapr]({{% ref tracing %}})
- [Learn more about observability in operating with Dapr]({{% ref tracing %}})

View File

@ -9,9 +9,7 @@ description: >
Dapr is a portable, event-driven runtime that makes it easy for any developer to build resilient, stateless, and stateful applications that run on the cloud and edge and embraces the diversity of languages and developer frameworks.
<div class="embed-responsive embed-responsive-16by9">
<iframe width="1120" height="630" src="https://www.youtube-nocookie.com/embed/9o9iDAgYBA8" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{< youtube id=9o9iDAgYBA8 >}}
## Any language, any framework, anywhere
@ -19,7 +17,7 @@ Dapr is a portable, event-driven runtime that makes it easy for any developer to
With the current wave of cloud adoption, web + database application architectures (such as classic 3-tier designs) are trending more toward microservice application architectures, which are inherently distributed. You shouldn't have to become a distributed systems expert just to create microservices applications.
This is where Dapr comes in. Dapr codifies the *best practices* for building microservice applications into open, independent APIs called [building blocks]({{< ref "#microservice-building-blocks-for-cloud-and-edge" >}}). Dapr's building blocks:
This is where Dapr comes in. Dapr codifies the *best practices* for building microservice applications into open, independent APIs called [building blocks]({{% ref "#microservice-building-blocks-for-cloud-and-edge" %}}). Dapr's building blocks:
- Enable you to build portable applications using the language and framework of your choice.
- Are completely independent
- Have no limit to how many you use in your application
@ -44,18 +42,18 @@ Each of these building block APIs is independent, meaning that you can use any n
| Building Block | Description |
|----------------|-------------|
| [**Service-to-service invocation**]({{< ref "service-invocation-overview.md" >}}) | Resilient service-to-service invocation enables method calls, including retries, on remote services, wherever they are located in the supported hosting environment.
| [**Publish and subscribe**]({{< ref "pubsub-overview.md" >}}) | Publishing events and subscribing to topics between services enables event-driven architectures to simplify horizontal scalability and make them resilient to failure. Dapr provides at-least-once message delivery guarantee, message TTL, consumer groups and other advance features.
| [**Workflows**]({{< ref "workflow-overview.md" >}}) | The workflow API can be combined with other Dapr building blocks to define long running, persistent processes or data flows that span multiple microservices using Dapr workflows.
| [**State management**]({{< ref "state-management-overview.md" >}}) | With state management for storing and querying key/value pairs, long-running, highly available, stateful services can be easily written alongside stateless services in your application. The state store is pluggable and examples include AWS DynamoDB, Azure Cosmos DB, Azure SQL Server, GCP Firebase, PostgreSQL or Redis, among others.
| [**Resource bindings**]({{< ref "bindings-overview.md" >}}) | Resource bindings with triggers builds further on event-driven architectures for scale and resiliency by receiving and sending events to and from any external source such as databases, queues, file systems, etc.
| [**Actors**]({{< ref "actors-overview.md" >}}) | A pattern for stateful and stateless objects that makes concurrency simple, with method and state encapsulation. Dapr provides many capabilities in its actor runtime, including concurrency, state, and life-cycle management for actor activation/deactivation, and timers and reminders to wake up actors.
| [**Secrets**]({{< ref "secrets-overview.md" >}}) | The secrets management API integrates with public cloud and local secret stores to retrieve the secrets for use in application code.
| [**Configuration**]({{< ref "configuration-api-overview.md" >}}) | The configuration API enables you to retrieve and subscribe to application configuration items from configuration stores.
| [**Distributed lock**]({{< ref "distributed-lock-api-overview.md" >}}) | The distributed lock API enables your application to acquire a lock for any resource that gives it exclusive access until either the lock is released by the application, or a lease timeout occurs.
| [**Cryptography**]({{< ref "cryptography-overview.md" >}}) | The cryptography API provides an abstraction layer on top of security infrastructure such as key vaults. It contains APIs that allow you to perform cryptographic operations, such as encrypting and decrypting messages, without exposing keys to your applications.
| [**Jobs**]({{< ref "jobs-overview.md" >}}) | The jobs API enables you to schedule jobs at specific times or intervals.
| [**Conversation**]({{< ref "conversation-overview.md" >}}) | The conversation API enables you to abstract the complexities of interacting with large language models (LLMs) and includes features such as prompt caching and personally identifiable information (PII) obfuscation. Using [conversation components]({{< ref supported-conversation >}}), you can supply prompts to converse with different LLMs.
| [**Service-to-service invocation**]({{% ref "service-invocation-overview" %}}) | Resilient service-to-service invocation enables method calls, including retries, on remote services, wherever they are located in the supported hosting environment.
| [**Publish and subscribe**]({{% ref "pubsub-overview" %}}) | Publishing events and subscribing to topics between services enables event-driven architectures to simplify horizontal scalability and make them resilient to failure. Dapr provides at-least-once message delivery guarantee, message TTL, consumer groups and other advance features.
| [**Workflows**]({{% ref "workflow-overview" %}}) | The workflow API can be combined with other Dapr building blocks to define long running, persistent processes or data flows that span multiple microservices using Dapr workflows.
| [**State management**]({{% ref "state-management-overview" %}}) | With state management for storing and querying key/value pairs, long-running, highly available, stateful services can be easily written alongside stateless services in your application. The state store is pluggable and examples include AWS DynamoDB, Azure Cosmos DB, Azure SQL Server, GCP Firebase, PostgreSQL or Redis, among others.
| [**Resource bindings**]({{% ref "bindings-overview" %}}) | Resource bindings with triggers builds further on event-driven architectures for scale and resiliency by receiving and sending events to and from any external source such as databases, queues, file systems, etc.
| [**Actors**]({{% ref "actors-overview" %}}) | A pattern for stateful and stateless objects that makes concurrency simple, with method and state encapsulation. Dapr provides many capabilities in its actor runtime, including concurrency, state, and life-cycle management for actor activation/deactivation, and timers and reminders to wake up actors.
| [**Secrets**]({{% ref "secrets-overview" %}}) | The secrets management API integrates with public cloud and local secret stores to retrieve the secrets for use in application code.
| [**Configuration**]({{% ref "configuration-api-overview" %}}) | The configuration API enables you to retrieve and subscribe to application configuration items from configuration stores.
| [**Distributed lock**]({{% ref "distributed-lock-api-overview" %}}) | The distributed lock API enables your application to acquire a lock for any resource that gives it exclusive access until either the lock is released by the application, or a lease timeout occurs.
| [**Cryptography**]({{% ref "cryptography-overview" %}}) | The cryptography API provides an abstraction layer on top of security infrastructure such as key vaults. It contains APIs that allow you to perform cryptographic operations, such as encrypting and decrypting messages, without exposing keys to your applications.
| [**Jobs**]({{% ref "jobs-overview" %}}) | The jobs API enables you to schedule jobs at specific times or intervals.
| [**Conversation**]({{% ref "conversation-overview" %}}) | The conversation API enables you to abstract the complexities of interacting with large language models (LLMs) and includes features such as prompt caching and personally identifiable information (PII) obfuscation. Using [conversation components]({{% ref supported-conversation %}}), you can supply prompts to converse with different LLMs.
### Cross-cutting APIs
@ -63,9 +61,9 @@ Alongside its building blocks, Dapr provides cross-cutting APIs that apply acros
| Building Block | Description |
|----------------|-------------|
| [**Resiliency**]({{< ref "resiliency-concept.md" >}}) | Dapr provides the capability to define and apply fault tolerance resiliency policies via a resiliency spec. Supported specs define policies for resiliency patterns such as timeouts, retries/back-offs, and circuit breakers.
| [**Observability**]({{< ref "observability-concept.md" >}}) | Dapr emits metrics, logs, and traces to debug and monitor both Dapr and user applications. Dapr supports distributed tracing to easily diagnose and serve inter-service calls in production using the W3C Trace Context standard and Open Telemetry to send to different monitoring tools.
| [**Security**]({{< ref "security-concept.md" >}}) | Dapr supports in-transit encryption of communication between Dapr instances using the Dapr control plane, Sentry service. You can bring in your own certificates, or let Dapr automatically create and persist self-signed root and issuer certificates.
| [**Resiliency**]({{% ref "resiliency-concept" %}}) | Dapr provides the capability to define and apply fault tolerance resiliency policies via a resiliency spec. Supported specs define policies for resiliency patterns such as timeouts, retries/back-offs, and circuit breakers.
| [**Observability**]({{% ref "observability-concept" %}}) | Dapr emits metrics, logs, and traces to debug and monitor both Dapr and user applications. Dapr supports distributed tracing to easily diagnose and serve inter-service calls in production using the W3C Trace Context standard and Open Telemetry to send to different monitoring tools.
| [**Security**]({{% ref "security-concept" %}}) | Dapr supports in-transit encryption of communication between Dapr instances using the Dapr control plane, Sentry service. You can bring in your own certificates, or let Dapr automatically create and persist self-signed root and issuer certificates.
## Sidecar architecture
@ -81,9 +79,9 @@ Dapr can be hosted in multiple environments, including:
### Self-hosted local development
In [self-hosted mode]({{< ref self-hosted-overview.md >}}), Dapr runs as a separate sidecar process, which your service code can call via HTTP or gRPC. Each running service has a Dapr runtime process (or sidecar) configured to use state stores, pub/sub, binding components, and the other building blocks.
In [self-hosted mode]({{% ref self-hosted-overview %}}), Dapr runs as a separate sidecar process, which your service code can call via HTTP or gRPC. Each running service has a Dapr runtime process (or sidecar) configured to use state stores, pub/sub, binding components, and the other building blocks.
You can use the [Dapr CLI](https://github.com/dapr/cli#launch-dapr-and-your-app) to run a Dapr-enabled application on your local machine. In the following diagram, Dapr's local development environment gets configured with the CLI `init` command. Try this out with the [getting started samples]({{< ref getting-started >}}).
You can use the [Dapr CLI](https://github.com/dapr/cli#launch-dapr-and-your-app) to run a Dapr-enabled application on your local machine. In the following diagram, Dapr's local development environment gets configured with the CLI `init` command. Try this out with the [getting started samples]({{% ref getting-started %}}).
<img src="/images/overview-standalone.png" width=1200 alt="Architecture diagram of Dapr in self-hosted mode">
@ -91,7 +89,7 @@ You can use the [Dapr CLI](https://github.com/dapr/cli#launch-dapr-and-your-app)
Kubernetes can be used for either:
- Local development (for example, with [minikube](https://minikube.sigs.k8s.io/docs/) and [k3S](https://k3s.io/)), or
- In [production]({{< ref kubernetes >}}).
- In [production]({{% ref kubernetes %}}).
In container hosting environments such as Kubernetes, Dapr runs as a sidecar container with the application container in the same pod.
@ -100,16 +98,16 @@ Dapr's `dapr-sidecar-injector` and `dapr-operator` control plane services provid
- Provide notifications of Dapr component updates provisioned in the cluster
<!-- IGNORE_LINKS -->
The `dapr-sentry` service is a certificate authority that enables mutual TLS between Dapr sidecar instances for secure data encryption, as well as providing identity via [Spiffe](https://spiffe.io/). For more information on the `Sentry` service, read the [security overview]({{< ref "security-concept.md#dapr-to-dapr-communication" >}})
The `dapr-sentry` service is a certificate authority that enables mutual TLS between Dapr sidecar instances for secure data encryption, as well as providing identity via [Spiffe](https://spiffe.io/). For more information on the `Sentry` service, read the [security overview]({{% ref "security-concept#dapr-to-dapr-communication" %}})
<!-- END_IGNORE -->
Deploying and running a Dapr-enabled application into your Kubernetes cluster is as simple as adding a few annotations to the deployment schemes. Visit the [Dapr on Kubernetes docs]({{< ref kubernetes >}}).
Deploying and running a Dapr-enabled application into your Kubernetes cluster is as simple as adding a few annotations to the deployment schemes. Visit the [Dapr on Kubernetes docs]({{% ref kubernetes %}}).
<img src="/images/overview-kubernetes.png" width=1200 alt="Architecture diagram of Dapr in Kubernetes mode">
### Clusters of physical or virtual machines
The Dapr control plane services can be deployed in high availability (HA) mode to clusters of physical or virtual machines in production. In the diagram below, the Actor `Placement` and security `Sentry` services are started on three different VMs to provide HA control plane. In order to provide name resolution using DNS for the applications running in the cluster, Dapr uses multicast DNS by default, but can also optionally support [Hashicorp Consul service]({{< ref setup-nr-consul >}}).
The Dapr control plane services can be deployed in high availability (HA) mode to clusters of physical or virtual machines in production. In the diagram below, the Actor `Placement` and security `Sentry` services are started on three different VMs to provide HA control plane. In order to provide name resolution using DNS for the applications running in the cluster, Dapr uses multicast DNS by default, but can also optionally support [Hashicorp Consul service]({{% ref setup-nr-consul %}}).
<img src="/images/overview-vms-hosting.png" width=1200 alt="Architecture diagram of Dapr control plane and Consul deployed to VMs in high availability mode">
@ -119,7 +117,7 @@ Dapr offers a variety of SDKs and frameworks to make it easy to begin developing
### Dapr SDKs
To make using Dapr more natural for different languages, it also includes [language specific SDKs]({{< ref sdks >}}) for:
To make using Dapr more natural for different languages, it also includes [language specific SDKs]({{% ref sdks %}}) for:
- Go
- Java
- JavaScript
@ -137,23 +135,23 @@ Dapr can be used from any developer framework. Here are some that have been inte
| Language | Frameworks | Description |
|----------|------------|-------------|
| [.NET]({{< ref dotnet >}}) | [ASP.NET Core](https://github.com/dapr/dotnet-sdk/tree/master/examples/AspNetCore) | Brings stateful routing controllers that respond to pub/sub events from other services. Can also take advantage of [ASP.NET Core gRPC Services](https://docs.microsoft.com/aspnet/core/grpc/).
| [Java]({{< ref java >}}) | [Spring Boot](https://spring.io/) | Build Spring boot applications with Dapr APIs
| [Python]({{< ref python >}}) | [Flask]({{< ref python-flask.md >}}) | Build Flask applications with Dapr APIs
| [.NET]({{% ref dotnet %}}) | [ASP.NET Core](https://github.com/dapr/dotnet-sdk/tree/master/examples/AspNetCore) | Brings stateful routing controllers that respond to pub/sub events from other services. Can also take advantage of [ASP.NET Core gRPC Services](https://docs.microsoft.com/aspnet/core/grpc/).
| [Java]({{% ref java %}}) | [Spring Boot](https://spring.io/) | Build Spring boot applications with Dapr APIs
| [Python]({{% ref python %}}) | [Flask]({{% ref python-flask %}}) | Build Flask applications with Dapr APIs
| [JavaScript](https://github.com/dapr/js-sdk) | [Express](https://expressjs.com/) | Build Express applications with Dapr APIs
| [PHP]({{< ref php >}}) | | You can serve with Apache, Nginx, or Caddyserver.
| [PHP]({{% ref php %}}) | | You can serve with Apache, Nginx, or Caddyserver.
#### Integrations and extensions
Visit the [integrations]({{< ref integrations >}}) page to learn about some of the first-class support Dapr has for various frameworks and external products, including:
Visit the [integrations]({{% ref integrations %}}) page to learn about some of the first-class support Dapr has for various frameworks and external products, including:
- Public cloud services, like Azure and AWS
- Visual Studio Code
- GitHub
## Designed for operations
Dapr is designed for [operations]({{< ref operations >}}) and security. The Dapr sidecars, runtime, components, and configuration can all be managed and deployed easily and securely to match your organization's needs.
Dapr is designed for [operations]({{% ref operations %}}) and security. The Dapr sidecars, runtime, components, and configuration can all be managed and deployed easily and securely to match your organization's needs.
The [dashboard](https://github.com/dapr/dashboard), installed via the Dapr CLI, provides a web-based UI enabling you to see information, view logs, and more for running Dapr applications.
Dapr supports [monitoring tools]({{< ref observability >}}) for deeper visibility into the Dapr system services and sidecars, while the [observability capabilities]({{< ref "observability-concept.md" >}}) of Dapr provide insights into your application, such as tracing and metrics.
Dapr supports [monitoring tools]({{% ref observability %}}) for deeper visibility into the Dapr system services and sidecars, while the [observability capabilities]({{% ref "observability-concept" %}}) of Dapr provide insights into your application, such as tracing and metrics.

View File

@ -17,7 +17,7 @@ Dapr provides a capability for defining and applying fault tolerance resiliency
- Retries/back-offs
- Circuit breakers
These policies can be applied to any Dapr API calls when calling components with a [resiliency spec]({{< ref resiliency-overview >}}).
These policies can be applied to any Dapr API calls when calling components with a [resiliency spec]({{% ref resiliency-overview %}}).
## App Health Checks
<img src="/images/observability-app-health.webp" width="800" alt="Diagram showing the app health feature. Running Dapr with app health enabled causes Dapr to periodically probe the app for its health">
@ -26,21 +26,21 @@ Applications can become unresponsive for a variety of reasons. For example, they
Dapr provides a capability for monitoring app health through probes that check the health of your application and react to status changes. When an unhealthy app is detected, Dapr stops accepting new work on behalf of the application.
Read more on how to apply [app health checks]({{< ref app-health >}}) to your application.
Read more on how to apply [app health checks]({{% ref app-health %}}) to your application.
## Sidecar Health Checks
<img src="/images/sidecar-health.png" width="800" alt="Diagram showing the app health feature. Running Dapr with app health enabled causes Dapr to periodically probe the app for its health">
Dapr provides a way to determine its health using an [HTTP `/healthz` endpoint]({{< ref health_api.md >}}). With this endpoint, the *daprd* process, or sidecar, can be:
Dapr provides a way to determine its health using an [HTTP `/healthz` endpoint]({{% ref health_api %}}). With this endpoint, the *daprd* process, or sidecar, can be:
- Probed for its health
- Determined for readiness and liveness
Read more on about how to apply [dapr health checks]({{< ref sidecar-health >}}) to your application.
Read more on about how to apply [dapr health checks]({{% ref sidecar-health %}}) to your application.
## Next steps
- [Learn more about resiliency]({{< ref resiliency-overview.md >}})
- [Learn more about resiliency]({{% ref resiliency-overview %}})
- Try out one of the Resiliency quickstarts:
- [Resiliency: Service-to-service]({{< ref resiliency-serviceinvo-quickstart.md >}})
- [Resiliency: State Management]({{< ref resiliency-state-quickstart.md >}})
- [Resiliency: Service-to-service]({{% ref resiliency-serviceinvo-quickstart %}})
- [Resiliency: State Management]({{% ref resiliency-state-quickstart %}})

View File

@ -23,13 +23,13 @@ Dapr provides end-to-end security with the service invocation API, with the abil
## Service invocation scoping access policy
Dapr applications can be scoped to namespaces for deployment and security. You can call between services deployed to different namespaces. Read the [Service invocation across namespaces]({{< ref "service-invocation-namespaces.md" >}}) article for more details.
Dapr applications can be scoped to namespaces for deployment and security. You can call between services deployed to different namespaces. Read the [Service invocation across namespaces]({{% ref "service-invocation-namespaces" %}}) article for more details.
Dapr applications can restrict which operations can be called, including which applications are allowed (or denied) to call it. Read [How-To: Apply access control list configuration for service invocation]({{< ref invoke-allowlist.md >}}) for more details.
Dapr applications can restrict which operations can be called, including which applications are allowed (or denied) to call it. Read [How-To: Apply access control list configuration for service invocation]({{% ref invoke-allowlist %}}) for more details.
## Pub/sub topic scoping access policy
For pub/sub components, you can limit which topic types and applications are allowed to publish and subscribe to specific topics. Read [Scope Pub/Sub topic access]({{< ref "pubsub-scopes.md" >}}) for more details.
For pub/sub components, you can limit which topic types and applications are allowed to publish and subscribe to specific topics. Read [Scope Pub/Sub topic access]({{% ref "pubsub-scopes" %}}) for more details.
## Encryption of data using mTLS
@ -58,7 +58,7 @@ When a new Dapr sidecar initializes, it checks if mTLS is enabled. If so, an ECD
mTLS can be turned on/off by editing the default configuration deployed with Dapr via the `spec.mtls.enabled` field.
[You can do this for both Kubernetes and self-hosted modes]({{< ref mtls.md >}}).
[You can do this for both Kubernetes and self-hosted modes]({{% ref mtls %}}).
#### mTLS in self hosted mode
@ -81,7 +81,7 @@ The diagram below shows how the Sentry system service issues certificates for ap
### Preventing IP addresses on Dapr
To prevent Dapr sidecars from being called on any IP address (especially in production environments such as Kubernetes), Dapr restricts its listening IP addresses to `localhost`. Use the [dapr-listen-addresses]({{<ref arguments-annotations-overview>}}) setting if you need to enable access from external addresses.
To prevent Dapr sidecars from being called on any IP address (especially in production environments such as Kubernetes), Dapr restricts its listening IP addresses to `localhost`. Use the [dapr-listen-addresses]({{%ref arguments-annotations-overview%}}) setting if you need to enable access from external addresses.
## Secure Dapr to application communication
@ -92,8 +92,8 @@ The Dapr sidecar runs close to the application through `localhost`, and is recom
For more details on configuring API token security, read:
- [Using an API token to authentication requests from an application to Dapr]({{< ref api-token.md >}}).
- [Using an API token to authentication requests from Dapr to the application]({{< ref app-api-token.md >}})
- [Using an API token to authentication requests from an application to Dapr]({{% ref api-token %}}).
- [Using an API token to authentication requests from Dapr to the application]({{% ref app-api-token %}})
## Secure Dapr to control plane communication
@ -124,11 +124,11 @@ Dapr is designed for operators to manage mTLS certificates and enforce OAuth pol
## mTLS Certificate deployment and rotation
While operators and developers can bring their own certificates into Dapr, Dapr automatically creates and persists self-signed root and issuer certificates. Read [Setup & configure mTLS certificates]({{< ref mtls.md >}}) for more details.
While operators and developers can bring their own certificates into Dapr, Dapr automatically creates and persists self-signed root and issuer certificates. Read [Setup & configure mTLS certificates]({{% ref mtls %}}) for more details.
## Middleware endpoint authorization with OAuth
With Dapr OAuth 2.0 middleware, you can enable OAuth authorization on Dapr endpoints for your APIs. Read [Configure endpoint authorization with OAuth]({{< ref oauth.md >}}) for details. Dapr has other middleware components that you can use for OpenID Connect and OPA Policies. For more details, [read about supported middleware]({{< ref supported-middleware.md >}}).
With Dapr OAuth 2.0 middleware, you can enable OAuth authorization on Dapr endpoints for your APIs. Read [Configure endpoint authorization with OAuth]({{% ref oauth %}}) for details. Dapr has other middleware components that you can use for OpenID Connect and OPA Policies. For more details, [read about supported middleware]({{% ref supported-middleware %}}).
## Network security
@ -144,19 +144,19 @@ In certain scenarios, such as with zero trust networks or when exposing the Dapr
<img src="/images/security-dapr-API-scoping.png" width=1000>
Read [How-To: Selectively enable Dapr APIs on the Dapr sidecar]({{< ref api-allowlist.md >}}) for more details.
Read [How-To: Selectively enable Dapr APIs on the Dapr sidecar]({{% ref api-allowlist %}}) for more details.
## Secret scoping access policy
To limit the Dapr application's access to secrets, you can define secret scopes. Add a secret scope policy to the application configuration with restrictive permissions. Read [How To: Use secret scoping]({{< ref secret-scope.md >}}) for more details.
To limit the Dapr application's access to secrets, you can define secret scopes. Add a secret scope policy to the application configuration with restrictive permissions. Read [How To: Use secret scoping]({{% ref secret-scope %}}) for more details.
## Component application scoping access policy and secret usage
Dapr components can be namespaced. That means a Dapr sidecar instance can only access the components that have been deployed to the same namespace. Read [How-To: Scope components to one or more applications using namespaces]({{< ref component-scopes.md >}}) for more details.
Dapr components can be namespaced. That means a Dapr sidecar instance can only access the components that have been deployed to the same namespace. Read [How-To: Scope components to one or more applications using namespaces]({{% ref component-scopes %}}) for more details.
Dapr provides application-level scoping for components by allowing you to specify which applications can consume specific components and deny others. Read [restricting application access to components with scopes]({{< ref "component-scopes.md#application-access-to-components-with-scopes" >}}) for more details.
Dapr provides application-level scoping for components by allowing you to specify which applications can consume specific components and deny others. Read [restricting application access to components with scopes]({{% ref "component-scopes#application-access-to-components-with-scopes" %}}) for more details.
Dapr components can use Dapr's built-in secret management capability to manage secrets. Read the [secret store overview]({{< ref secrets-overview.md >}}) and [How-To: Reference secrets in components]({{< ref component-secrets.md >}}) for more details.
Dapr components can use Dapr's built-in secret management capability to manage secrets. Read the [secret store overview]({{% ref secrets-overview %}}) and [How-To: Reference secrets in components]({{% ref component-secrets %}}) for more details.
## Bindings security
@ -173,7 +173,7 @@ By default Dapr doesn't transform the state data from applications. This means:
Dapr components can use a configured authentication method to authenticate with the underlying state store. Many state store implementations use official client libraries that generally use secured communication channels with the servers.
However, application state often needs to get encrypted at rest to provide stronger security in enterprise workloads or regulated environments. Dapr provides automatic client-side state encryption based on AES256. Read [How-To: Encrypt application state]({{< ref howto-encrypt-state.md >}}) for more details.
However, application state often needs to get encrypted at rest to provide stronger security in enterprise workloads or regulated environments. Dapr provides automatic client-side state encryption based on AES256. Read [How-To: Encrypt application state]({{% ref howto-encrypt-state %}}) for more details.
## Dapr Runtime state
@ -281,8 +281,8 @@ The full report can be found [here](/docs/Dapr-july-2020-security-audit-report.p
## Reporting a security issue
Visit [this page]({{< ref support-security-issues.md >}}) to report a security issue to the Dapr maintainers.
Visit [this page]({{% ref support-security-issues %}}) to report a security issue to the Dapr maintainers.
## Related links
[Operational Security]({{< ref "security.md" >}})
[Operational Security]({{% ref "security" %}})

View File

@ -11,14 +11,14 @@ This page details all of the common terms you may come across in the Dapr docs.
| Term | Definition | More information |
|:-----|------------|------------------|
| App/Application | A running service/binary, usually one that you as the user create and run.
| Building block | An API that Dapr provides to users to help in the creation of microservices and applications. | [Dapr building blocks]({{< ref building-blocks-concept.md >}})
| Component | Modular types of functionality that are used either individually or with a collection of other components, by a Dapr building block. | [Dapr components]({{< ref components-concept.md >}})
| Configuration | A YAML file declaring all of the settings for Dapr sidecars or the Dapr control plane. This is where you can configure control plane mTLS settings, or the tracing and middleware settings for an application instance. | [Dapr configuration]({{< ref configuration-concept.md >}})
| Dapr | Distributed Application Runtime. | [Dapr overview]({{< ref overview.md >}})
| Dapr control plane | A collection of services that are part of a Dapr installation on a hosting platform such as a Kubernetes cluster. This allows Dapr-enabled applications to run on the platform and handles Dapr capabilities such as actor placement, Dapr sidecar injection, or certificate issuance/rollover. | [Self-hosted overview]({{< ref self-hosted-overview >}})<br />[Kubernetes overview]({{< ref kubernetes-overview >}})
| HTTPEndpoint | HTTPEndpoint is a Dapr resource use to identify non-Dapr endpoints to invoke via the service invocation API. | [Service invocation API]({{< ref service_invocation_api.md >}})
| Namespacing | Namespacing in Dapr provides isolation, and thus provides multi-tenancy. | Learn more about namespacing [components]({{< ref component-scopes.md >}}), [service invocation]({{< ref service-invocation-namespaces.md >}}), [pub/sub]({{< ref pubsub-namespaces.md >}}), and [actors]({{< ref namespaced-actors.md >}})
| Self-hosted | Windows/macOS/Linux machine(s) where you can run your applications with Dapr. Dapr provides the capability to run on machines in "self-hosted" mode. | [Self-hosted mode]({{< ref self-hosted-overview.md >}})
| Building block | An API that Dapr provides to users to help in the creation of microservices and applications. | [Dapr building blocks]({{% ref building-blocks-concept %}})
| Component | Modular types of functionality that are used either individually or with a collection of other components, by a Dapr building block. | [Dapr components]({{% ref components-concept %}})
| Configuration | A YAML file declaring all of the settings for Dapr sidecars or the Dapr control plane. This is where you can configure control plane mTLS settings, or the tracing and middleware settings for an application instance. | [Dapr configuration]({{% ref configuration-concept %}})
| Dapr | Distributed Application Runtime. | [Dapr overview]({{% ref overview %}})
| Dapr control plane | A collection of services that are part of a Dapr installation on a hosting platform such as a Kubernetes cluster. This allows Dapr-enabled applications to run on the platform and handles Dapr capabilities such as actor placement, Dapr sidecar injection, or certificate issuance/rollover. | [Self-hosted overview]({{% ref self-hosted-overview %}})<br />[Kubernetes overview]({{% ref kubernetes-overview %}})
| HTTPEndpoint | HTTPEndpoint is a Dapr resource use to identify non-Dapr endpoints to invoke via the service invocation API. | [Service invocation API]({{% ref service_invocation_api %}})
| Namespacing | Namespacing in Dapr provides isolation, and thus provides multi-tenancy. | Learn more about namespacing [components]({{% ref component-scopes %}}), [service invocation]({{% ref service-invocation-namespaces %}}), [pub/sub]({{% ref pubsub-namespaces %}}), and [actors]({{% ref namespaced-actors %}})
| Self-hosted | Windows/macOS/Linux machine(s) where you can run your applications with Dapr. Dapr provides the capability to run on machines in "self-hosted" mode. | [Self-hosted mode]({{% ref self-hosted-overview %}})
| Service | A running application or binary. This can refer to your application or to a Dapr application.
| Sidecar | A program that runs alongside your application as a separate process or container. | [Sidecar pattern](https://docs.microsoft.com/azure/architecture/patterns/sidecar)

View File

@ -16,7 +16,7 @@ See the [Dapr community repository](https://github.com/dapr/community) for more
Below is a list of repositories under the Dapr organization where you can contribute:
1. **Docs**: This [repository](https://github.com/dapr/docs) contains the documentation for Dapr. You can contribute by updating existing documentation, fixing errors, or adding new content to improve user experience and clarity. Please see the specific guidelines for [docs contributions]({{< ref contributing-docs >}}).
1. **Docs**: This [repository](https://github.com/dapr/docs) contains the documentation for Dapr. You can contribute by updating existing documentation, fixing errors, or adding new content to improve user experience and clarity. Please see the specific guidelines for [docs contributions]({{% ref contributing-docs %}}).
2. **Quickstarts**: The Quickstarts [repository](https://github.com/dapr/quickstarts) provides simple, step-by-step guides to help users get started with Dapr quickly. [Contributions in this repository](https://github.com/dapr/quickstarts/blob/master/CONTRIBUTING.md) involve creating new quickstarts, improving existing ones, or ensuring they stay up-to-date with the latest features.
@ -24,7 +24,7 @@ See the [Dapr community repository](https://github.com/dapr/community) for more
4. **Components-contrib**: This [repository](https://github.com/dapr/components-contrib) hosts a collection of community-contributed components for Dapr. You can contribute by adding new components, improving existing ones, or reviewing and testing contributions from the community.
5. **SDKs**: Dapr SDKs provide libraries for various programming languages to interact with Dapr. You can contribute by improving SDK functionalities, fixing bugs, or adding support for new features. Please see the [contribution guidelines]({{< ref sdk-contrib >}}) for specific SDKs.
5. **SDKs**: Dapr SDKs provide libraries for various programming languages to interact with Dapr. You can contribute by improving SDK functionalities, fixing bugs, or adding support for new features. Please see the [contribution guidelines]({{% ref sdk-contrib %}}) for specific SDKs.
6. **CLI**: Dapr cli sets up Dapr on a local dev machine or a Kubernetes cluster for launching and managing Dapr instances. Contributions to the CLI repository include adding new features, fixing bugs, improving usability, and ensuring compatibility with the latest Dapr releases. Please see the [Development Guide](https://github.com/dapr/cli/blob/master/docs/development/development.md) for help in getting started with developing the Dapr cli.
@ -52,7 +52,7 @@ Before you submit an issue, make sure you've checked the following:
- 👎 down-vote
1. For bugs
- Check it's not an environment issue. For example, if running on Kubernetes, make sure prerequisites are in place. (state stores, bindings, etc.)
- You have as much data as possible. This usually comes in the form of logs and/or stacktrace. If running on Kubernetes or other environment, look at the logs of the Dapr services (runtime, operator, placement service). More details on how to get logs can be found [here]({{< ref "logs-troubleshooting.md" >}}).
- You have as much data as possible. This usually comes in the form of logs and/or stacktrace. If running on Kubernetes or other environment, look at the logs of the Dapr services (runtime, operator, placement service). More details on how to get logs can be found [here]({{% ref "logs-troubleshooting" %}}).
1. For proposals
- Many changes to the Dapr runtime may require changes to the API. In that case, the best place to discuss the potential feature is the main [Dapr repo](https://github.com/dapr/dapr).
- Other examples could include bindings, state stores or entirely new components.
@ -64,12 +64,12 @@ All contributions come through pull requests. To submit a proposed change, follo
1. Make sure there's an issue (bug or proposal) raised, which sets the expectations for the contribution you are about to make.
1. Fork the relevant repo and create a new branch
- Some Dapr repos support [Codespaces]({{< ref codespaces.md >}}) to provide an instant environment for you to build and test your changes.
- Some Dapr repos support [Codespaces]({{% ref codespaces %}}) to provide an instant environment for you to build and test your changes.
- See the [Developing Dapr docs](https://github.com/dapr/dapr/blob/master/docs/development/developing-dapr.md) for more information about setting up a Dapr development environment.
1. Create your change
- Code changes require tests
1. Update relevant documentation for the change
1. Commit with [DCO sign-off]({{< ref "contributing-overview.md#developer-certificate-of-origin-signing-your-work" >}}) and open a PR
1. Commit with [DCO sign-off]({{% ref "contributing-overview#developer-certificate-of-origin-signing-your-work" %}}) and open a PR
1. Wait for the CI process to finish and make sure all checks are green
1. A maintainer of the project will be assigned, and you can expect a review within a few days

View File

@ -8,13 +8,13 @@ description: Get started with contributing to the Dapr docs
In this guide, you'll learn how to contribute to the [Dapr docs repository](https://github.com/dapr/docs). Since Dapr docs are published to [docs.dapr.io](https://docs.dapr.io), you must make sure your contributions compile and publish correctly.
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/uPYuXcaEs-c" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
{{< youtube id=uPYuXcaEs-c >}}
## Prerequisites
Before contributing to the Dapr docs:
- Review the [guidance around general Dapr project contributions]({{< ref contributing-overview>}}).
- Review the [guidance around general Dapr project contributions]({{% ref contributing-overview%}}).
- Install and set up your local environment with [Hugo](https://gohugo.io/) with the [Docsy](https://docsy.dev) theme. Follow the instructions in the repository [README.md](https://github.com/dapr/docs/blob/master/README.md#environment-setup).
- Fork and clone the [docs repository](https://github.com/dapr/docs).
@ -66,9 +66,9 @@ Select the topic type below to view a suggested template to help you get started
| Topic type | What is it? |
| ---------- | ----------- |
| [Concept]({{< ref "concept-template.md" >}}) | Answers the question, "What problems does this help me solve?" Avoid repeating the API or component spec; provide more details. |
| [Quickstart]({{< ref "quickstart-template.md" >}}) | Provides a "Five minutes to _wow_" experience. Walk the reader quickly through a feature or API and how it works in a controlled example. |
| [How-to]({{< ref "howto-template.md" >}}) | Provides a detailed, practical step-by-step through a Dapr feature or technology. Encourage the reader to try with their own scenario, rather than the controlled scenario provided in a quickstart. |
| [Concept]({{% ref "concept-template" %}}) | Answers the question, "What problems does this help me solve?" Avoid repeating the API or component spec; provide more details. |
| [Quickstart]({{% ref "quickstart-template" %}}) | Provides a "Five minutes to _wow_" experience. Walk the reader quickly through a feature or API and how it works in a controlled example. |
| [How-to]({{% ref "howto-template" %}}) | Provides a detailed, practical step-by-step through a Dapr feature or technology. Encourage the reader to try with their own scenario, rather than the controlled scenario provided in a quickstart. |
## Requirements for docs.dapr.io
@ -128,13 +128,13 @@ Hugo `ref` and `relref` [shortcodes](https://gohugo.io/content-management/cross-
For example, this shortcode, written inline with the rest of the markdown page, will link to the _index.md of the section/folder name:
```md
{{</* ref "folder" */>}}
{{%/* ref "folder" */%}}
```
While this shortcode will link to a specific page:
```md
{{</* ref "page.md" */>}}
{{%/* ref "page" */%}}
```
All pages and folders need to have _globally unique names_ in order for the ref shortcode to work properly. If there are duplicate names, the build will break and an error will be thrown.
@ -153,7 +153,7 @@ As a general rule, the section short name is the text of the section title, all
As an example, for this specific section, the complete reference to the page and section would be:
```md
{{</* ref "contributing-docs.md#referencing-sections-in-other-pages" */>}}
{{%/* ref "contributing-docs#referencing-sections-in-other-pages" */%}}
```
## Shortcodes
@ -189,17 +189,17 @@ Tabs are made possible through [Hugo shortcodes](https://gohugo.io/content-manag
The overall format is:
```
{{</* tabs [Tab1] [Tab2]>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab header="Tab1" %}}
[Content for Tab1]
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab header="Tab2" %}}
[Content for Tab2]
{{% /codetab %}}
{{% /tab %}}
{{< /tabs */>}}
{{< /tabpane >}}
```
All content you author will be rendered to markdown, so you can include images, code blocks, YouTube videos, and more.
@ -207,164 +207,65 @@ All content you author will be rendered to markdown, so you can include images,
#### Example
````
{{</* tabs Windows Linux MacOS>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab header="Windows" %}}
```powershell
powershell -Command "iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex"
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab header="Linux" %}}
```bash
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab header="MacOS" %}}
```bash
brew install dapr/tap/dapr-cli
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs */>}}
{{< /tabpane >}}
````
This example will render to this:
{{< tabs Windows Linux MacOS>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab header="Windows" %}}
```powershell
powershell -Command "iwr -useb https://raw.githubusercontent.com/dapr/cli/master/install/install.ps1 | iex"
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab header="Linux" %}}
```bash
wget -q https://raw.githubusercontent.com/dapr/cli/master/install/install.sh -O - | /bin/bash
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab header="MacOS" %}}
```bash
brew install dapr/tap/dapr-cli
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
### Embedded code snippets
Use the `code-snippet` shortcode to reference code snippets from the `static/code` directory.
```
{{</* code-snippet file="myfile.py" lang="python" */>}}
```
{{% alert title="Warning" color="warning" %}}
All Dapr sample code should be self-contained in separate files, not in markdown. Use these techniques to highlight the parts of the sample code users should focus on.
{{% /alert %}}
Use the `lang` (default `txt`) parameter to configure the language used for syntax highlighting.
Use the `marker` parameter to limit the embedded snipped to a portion of the sample file. This is useful when you want to show just a portion of a larger file. Typically, you'd do this by:
1. Surrounding the interesting code with comments.
1. Passing the comment text into `marker`.
The shortcode below and code sample:
```
{{</* code-snippet file="./contributing-1.py" lang="python" marker="#SAMPLE" */>}}
```
```python
import json
import time
from dapr.clients import DaprClient
#SAMPLE
with DaprClient() as d:
req_data = {
'id': 1,
'message': 'hello world'
}
while True:
# Create a typed message with content type and body
resp = d.invoke_method(
'invoke-receiver',
'my-method',
data=json.dumps(req_data),
)
# Print the response
print(resp.content_type, flush=True)
print(resp.text(), flush=True)
time.sleep(2)
#SAMPLE
```
Will result in the following output:
{{< code-snippet file="contributing-1.py" lang="python" marker="#SAMPLE" >}}
Use the `replace-key-[token]` and `replace-value-[token]` parameters to limit the embedded snipped to a portion of the sample file. This is useful when you want abbreviate a portion of the code sample. Multiple replacements are supported with multiple values of `token`.
The shortcode below and code sample:
```
{{</* code-snippet file="./contributing-2.py" lang="python" replace-key-imports="#IMPORTS" replace-value-imports="# Import statements" */>}}
```
```python
#IMPORTS
import json
import time
#IMPORTS
from dapr.clients import DaprClient
with DaprClient() as d:
req_data = {
'id': 1,
'message': 'hello world'
}
while True:
# Create a typed message with content type and body
resp = d.invoke_method(
'invoke-receiver',
'my-method',
data=json.dumps(req_data),
)
# Print the response
print(resp.content_type, flush=True)
print(resp.text(), flush=True)
time.sleep(2)
```
Will result in the following output:
{{< code-snippet file="./contributing-2.py" lang="python" replace-key-imports="#IMPORTS" replace-value-imports="# Import statements" >}}
{{< /tabpane >}}
### YouTube videos
Hugo can automatically embed YouTube videos using a shortcode:
```
{{</* youtube [VIDEO ID] */>}}
{{%/* youtube [VIDEO ID] */%}}
```
#### Example
@ -374,7 +275,7 @@ Given the video https://youtu.be/dQw4w9WgXcQ
The shortcode would be:
```
{{</* youtube dQw4w9WgXcQ */>}}
{{%/* youtube dQw4w9WgXcQ */%}}
```
### Buttons
@ -386,7 +287,7 @@ An optional "newtab" parameter will indicate if the page should open in a new ta
#### Link to an external page
```
{{</* button text="My Button" link="https://example.com" */>}}
{{%/* button text="My Button" link="https://example.com" */%}}
```
{{< button text="My Button" link="https://example.com" >}}
@ -396,30 +297,30 @@ An optional "newtab" parameter will indicate if the page should open in a new ta
You can also reference pages in your button as well:
```
{{</* button text="My Button" page="contributing" newtab="true" */>}}
{{%/* button text="My Button" page="contributing" newtab="true" */%}}
```
{{< button text="My Button" page="contributing" newtab="true" >}}
{{< button text="My Button" page="contributing.md" newtab="true" >}}
#### Button colors
You can customize the colors using the Bootstrap colors:
```
{{</* button text="My Button" link="https://example.com" color="primary" */>}}
{{</* button text="My Button" link="https://example.com" color="secondary" */>}}
{{</* button text="My Button" link="https://example.com" color="success" */>}}
{{</* button text="My Button" link="https://example.com" color="danger" */>}}
{{</* button text="My Button" link="https://example.com" color="warning" */>}}
{{</* button text="My Button" link="https://example.com" color="info" */>}}
{{%/* button text="My Button" link="https://example.com" color="primary" */%}}
{{%/* button text="My Button" link="https://example.com" color="secondary" */%}}
{{%/* button text="My Button" link="https://example.com" color="success" */%}}
{{%/* button text="My Button" link="https://example.com" color="danger" */%}}
{{%/* button text="My Button" link="https://example.com" color="warning" */%}}
{{%/* button text="My Button" link="https://example.com" color="info" */%}}
```
{{< button text="My Button" link="https://example.com" color="primary" >}}
{{< button text="My Button" link="https://example.com" color="secondary" >}}
{{< button text="My Button" link="https://example.com" color="success" >}}
{{< button text="My Button" link="https://example.com" color="danger" >}}
{{< button text="My Button" link="https://example.com" color="warning" >}}
{{< button text="My Button" link="https://example.com" color="info" >}}
{{% button text="My Button" link="https://example.com" color="primary" %}}
{{% button text="My Button" link="https://example.com" color="secondary" %}}
{{% button text="My Button" link="https://example.com" color="success" %}}
{{% button text="My Button" link="https://example.com" color="danger" %}}
{{% button text="My Button" link="https://example.com" color="warning" %}}
{{% button text="My Button" link="https://example.com" color="info" %}}
### References
@ -463,4 +364,4 @@ Steps to add a language:
## Next steps
Get started by copying and working from one of [the Dapr doc templates]({{< ref docs-templates >}}).
Get started by copying and working from one of [the Dapr doc templates]({{% ref docs-templates %}}).

View File

@ -22,7 +22,7 @@ When naming your conceptual article, make sure it is consistent with the spec in
This template is only a suggestion. Feel free to change based on your document's purpose.
{{% /alert %}}
Learn more about [contributing to the Dapr docs]({{< ref contributing-docs.md >}}), like [front-matter]({{< ref "contributing-docs.md#front-matter" >}}) and [shortcodes]({{< ref "contributing-docs.md#shortcodes" >}}).
Learn more about [contributing to the Dapr docs]({{% ref contributing-docs %}}), like [front-matter]({{% ref "contributing-docs#front-matter" %}}) and [shortcodes]({{% ref "contributing-docs#shortcodes" %}}).
### Template

View File

@ -22,7 +22,7 @@ When naming your how-to document, include the sub-directory name in the file nam
This template is only a suggestion. Feel free to change based on your document's purpose.
{{% /alert %}}
Learn more about [contributing to the Dapr docs]({{< ref contributing-docs.md >}}), like [front-matter]({{< ref "contributing-docs.md#front-matter" >}}) and [shortcodes]({{< ref "contributing-docs.md#shortcodes" >}}).
Learn more about [contributing to the Dapr docs]({{% ref contributing-docs %}}), like [front-matter]({{% ref "contributing-docs#front-matter" %}}) and [shortcodes]({{% ref "contributing-docs#shortcodes" %}}).
### Template

View File

@ -16,7 +16,7 @@ The quickstart instructions should be succinct, direct, and clear. The sole purp
This template is only a suggestion. Feel free to change based on your document's purpose.
{{% /alert %}}
Learn more about [contributing to the Dapr docs]({{< ref contributing-docs.md >}}), like [front-matter]({{< ref "contributing-docs.md#front-matter" >}}) and [shortcodes]({{< ref "contributing-docs.md#shortcodes" >}}).
Learn more about [contributing to the Dapr docs]({{% ref contributing-docs %}}), like [front-matter]({{% ref "contributing-docs#front-matter" %}}) and [shortcodes]({{% ref "contributing-docs#shortcodes" %}}).
### Template

View File

@ -8,7 +8,7 @@ description: "Get started as a Dapr docs maintainer and approver."
In this guide, youll learn how to perform routine Dapr docs maintainer and approver responsibilities. In order to successfully accomplish these tasks, you need either approver or maintainer status in the [`dapr/docs`](https://github.com/dapr/docs) repo.
To learn how to contribute to Dapr docs, review the [Contributor guide]({{< ref contributing-docs.md >}}).
To learn how to contribute to Dapr docs, review the [Contributor guide]({{% ref contributing-docs %}}).
## Branch guidance
@ -16,7 +16,7 @@ The Dapr docs handles branching differently than most code repositories. Instead
For the full list, visit the [Docs repo](https://github.com/dapr/docs#branch-guidance).
Read the [contributor's guide]({{< ref "contributing-docs.md#branch-guidance" >}}) for more information about release branches.
Read the [contributor's guide]({{% ref "contributing-docs#branch-guidance" %}}) for more information about release branches.
## Upmerge from current release branch to the pre-release branch
@ -298,7 +298,7 @@ Next, create a new website for the future Dapr release. To do this, you'll need
#### Prerequisites
- Docs maintainer status in the `dapr/docs` repo.
- Access to the active Dapr Azure Subscription with Contributor or Owner access to create resources.
- [Azure Developer CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd?tabs=winget-windows%2Cbrew-mac%2Cscript-linux&pivots=os-windows) installed on your machine.
- [Azure Developer CLI](https://learn.microsoft.com/azure/developer/azure-developer-cli/install-azd?tabpane=winget-windows%2Cbrew-mac%2Cscript-linux&pivots=os-windows) installed on your machine.
- Your own fork of the [`dapr/docs` repo](https://github.com/dapr/docs) cloned to your machine.
#### Deploy Azure Static Web App
@ -408,4 +408,3 @@ To bring updates to the SDK docs live to the Dapr docs site, you need to perform
## Next steps
For guidance on contributing to Dapr docs, read the [Contributor Guide]({{< ref contributing-docs.md >}}).

View File

@ -25,7 +25,7 @@ brew install --cask font-space-grotesk
## Giving a Dapr presentation
- Begin by downloading the [Dapr Presentation Decks](/presentations/dapr-slidedecks.zip). These contain slides, diagrams, and graphical assets needed to give a Dapr presentation.
- Next, review the docs to make sure you understand the [concepts]({{< ref concepts >}}).
- Next, review the docs to make sure you understand the [concepts]({{% ref concepts %}}).
- Use the Dapr [quickstarts](https://github.com/dapr/quickstarts) repo to show demos of how to use Dapr.
- Once you've done a Dapr presentation, claim the *Dapr Presenter* badge by adding your presentation to [this table](https://github.com/dapr/community/tree/master/presentations) in the Dapr Community repository.

View File

@ -6,7 +6,7 @@ weight: 10
description: "Dapr capabilities that solve common development challenges for distributed applications"
---
Get a high-level [overview of Dapr building blocks]({{< ref building-blocks-concept >}}) in the **Concepts** section.
Get a high-level [overview of Dapr building blocks]({{% ref building-blocks-concept %}}) in the **Concepts** section.
<img src="/images/buildingblocks-overview.png" alt="Diagram showing the different Dapr API building blocks" width=1000>

View File

@ -8,7 +8,7 @@ description: Encapsulate code and data in reusable actor objects as a common mic
{{% alert title="More about Dapr Actors" color="primary" %}}
Learn more about how to use Dapr Actors:
- Try the [Actors quickstart]({{< ref actors-quickstart.md >}}).
- Explore actors via any of the [Dapr SDKs]({{< ref sdks >}}).
- Review the [Actors API reference documentation]({{< ref actors_api.md >}}).
- Try the [Actors quickstart]({{% ref actors-quickstart %}}).
- Explore actors via any of the [Dapr SDKs]({{% ref sdks %}}).
- Review the [Actors API reference documentation]({{% ref actors_api %}}).
{{% /alert %}}

View File

@ -29,9 +29,9 @@ The `maxStackDepth` parameter sets a value that controls how many reentrant call
The reentrant actor must provide the appropriate configuration. This is done by the actor's endpoint for `GET /dapr/config`, similar to other actor configuration elements.
{{< tabs ".NET" JavaScript Python Java Go >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
<!--dotnet-->
```csharp
@ -53,9 +53,9 @@ public class Startup
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
<!--javascript-->
```js
@ -72,9 +72,9 @@ const clientOptions = {
};
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
<!--python-->
```python
@ -100,19 +100,18 @@ def do_something_reentrant():
# invoke another actor here, reentrancy will be handled automatically
return
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
<!--java-->
```java
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
Here is a snippet of an actor written in Golang providing the reentrancy configuration via the HTTP API. Reentrancy has not yet been included into the Go SDK.
@ -168,23 +167,21 @@ func reentrantCallHandler(w http.ResponseWriter, r *http.Request) {
}
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Demo
Watch this [video](https://www.youtube.com/watch?v=QADHQ5v-gww&list=PLcip_LgkYwzuF-OV6zKRADoiBvUvGhkao&t=674s) on how to use actor reentrancy.
<div class="embed-responsive embed-responsive-16by9">
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/QADHQ5v-gww?start=674" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{< youtube id=QADHQ5v-gww start=674 >}}
## Next steps
{{< button text="Actors in the Dapr SDKs" page="developing-applications/sdks/#sdk-languages" >}}
{{< button text="Actors in the Dapr SDKs" page="developing-applications/sdks/_index.md#sdk-languages" >}}
## Related links
- [Actors API reference]({{< ref actors_api.md >}})
- [Actors overview]({{< ref actors-overview.md >}})
- [Actors API reference]({{% ref actors_api %}})
- [Actors overview]({{% ref actors-overview %}})

View File

@ -8,7 +8,7 @@ aliases:
- "/developing-applications/building-blocks/actors/actors-background"
---
Now that you've learned about the [actor building block]({{< ref "actors-overview.md" >}}) at a high level, let's deep dive into the features and concepts included with actors in Dapr.
Now that you've learned about the [actor building block]({{% ref "actors-overview" %}}) at a high level, let's deep dive into the features and concepts included with actors in Dapr.
## Actor lifetime
@ -52,7 +52,7 @@ This simplifies some choices, but also carries some consideration:
- Because actors are randomly placed, it should be expected that actor operations always require network communication, including serialization and deserialization of method call data, incurring latency and overhead.
{{% alert title="Note" color="primary" %}}
Note: The Dapr actor Placement service is only used for actor placement and therefore is not needed if your services are not using Dapr actors. The Placement service can run in all [hosting environments]({{< ref hosting >}}), including self-hosted and Kubernetes.
Note: The Dapr actor Placement service is only used for actor placement and therefore is not needed if your services are not using Dapr actors. The Placement service can run in all [hosting environments]({{% ref hosting %}}), including self-hosted and Kubernetes.
{{% /alert %}}
## Actor communication
@ -65,9 +65,9 @@ POST/GET/PUT/DELETE http://localhost:3500/v1.0/actors/<actorType>/<actorId>/<met
You can provide any data for the actor method in the request body, and the response for the request would be in the response body which is the data from actor call.
Another, and perhaps more convenient, way of interacting with actors is via SDKs. Dapr currently supports actors SDKs in [.NET]({{< ref "dotnet-actors" >}}), [Java]({{< ref "java#actors" >}}), and [Python]({{< ref "python-actor" >}}).
Another, and perhaps more convenient, way of interacting with actors is via SDKs. Dapr currently supports actors SDKs in [.NET]({{% ref "dotnet-actors" %}}), [Java]({{% ref "java#actors" %}}), and [Python]({{% ref "python-actor" %}}).
Refer to [Dapr Actor Features]({{< ref howto-actors.md >}}) for more details.
Refer to [Dapr Actor Features]({{% ref howto-actors %}}) for more details.
### Concurrency
@ -81,7 +81,7 @@ Actors can deadlock on each other if there is a circular request between two act
#### Reentrancy
To allow actors to "re-enter" and invoke methods on themselves, see [Actor Reentrancy]({{<ref actor-reentrancy.md>}}).
To allow actors to "re-enter" and invoke methods on themselves, see [Actor Reentrancy]({{%ref actor-reentrancy%}}).
### Turn-based access
@ -99,6 +99,6 @@ The following example illustrates the above concepts. Consider an actor type tha
## Related links
- [Actors API reference]({{< ref actors_api.md >}})
- [Actors overview]({{< ref actors-overview.md >}})
- [How to: Use virtual actors in Dapr]({{< ref howto-actors.md >}})
- [Actors API reference]({{% ref actors_api %}})
- [Actors overview]({{% ref actors-overview %}})
- [How to: Use virtual actors in Dapr]({{% ref howto-actors %}})

View File

@ -24,11 +24,11 @@ Every actor is defined as an instance of an actor type, identical to the way an
[The following overview video and demo](https://www.youtube.com/live/0y7ne6teHT4?si=dWNgtsp61f3Sjq0n&t=10797) demonstrates how actors in Dapr work.
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/0y7ne6teHT4?si=dWNgtsp61f3Sjq0n&amp;start=10797" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
{{< youtube id=0y7ne6teHT4 start=10797 >}}
## Dapr actors vs. Dapr Workflow
Dapr actors builds on the state management and service invocation APIs to create stateful, long running objects with identity. [Dapr Workflow]({{< ref workflow-overview.md >}}) and Dapr Actors are related, with workflows building on actors to provide a higher level of abstraction to orchestrate a set of actors, implementing common workflow patterns and managing the lifecycle of actors on your behalf.
Dapr actors builds on the state management and service invocation APIs to create stateful, long running objects with identity. [Dapr Workflow]({{% ref workflow-overview %}}) and Dapr Actors are related, with workflows building on actors to provide a higher level of abstraction to orchestrate a set of actors, implementing common workflow patterns and managing the lifecycle of actors on your behalf.
Dapr actors are designed to provide a way to encapsulate state and behavior within a distributed system. An actor can be activated on demand by a client application. When an actor is activated, it is assigned a unique identity, which allows it to maintain its state across multiple invocations. This makes actors useful for building stateful, scalable, and fault-tolerant distributed applications.
@ -48,9 +48,9 @@ Generally speaking, consider the actor pattern to model your problem or scenario
### When to use Dapr Workflow
You would use Dapr Workflow when you need to define and orchestrate complex workflows that involve multiple services and components. For example, using the [chat application example earlier]({{< ref "#when-to-use-dapr-actors" >}}), you might use Dapr Workflows to define the overall workflow of the application, such as how new users are registered, how messages are sent and received, and how the application handles errors and exceptions.
You would use Dapr Workflow when you need to define and orchestrate complex workflows that involve multiple services and components. For example, using the [chat application example earlier]({{% ref "#when-to-use-dapr-actors" %}}), you might use Dapr Workflows to define the overall workflow of the application, such as how new users are registered, how messages are sent and received, and how the application handles errors and exceptions.
[Learn more about Dapr Workflow and how to use workflows in your application.]({{< ref workflow-overview.md >}})
[Learn more about Dapr Workflow and how to use workflows in your application.]({{% ref workflow-overview %}})
## Actor types and actor IDs
@ -64,7 +64,7 @@ Each actor is uniquely identified by an actor ID. An actor ID can be _any_ strin
Dapr supports namespaced actors. An actor type can be deployed into different namespaces. You can call instances of these actors in the same namespace.
[Learn more about namespaced actors and how they work.]({{< ref namespaced-actors.md >}})
[Learn more about namespaced actors and how they work.]({{% ref namespaced-actors %}})
### Actor lifetime
@ -75,13 +75,13 @@ Since Dapr actors are virtual, they do not need to be explicitly created or dest
An actor's state outlives the object's lifetime, as state is stored in the configured state provider for Dapr runtime.
[Learn more about actor lifetimes.]({{< ref "actors-features-concepts.md#actor-lifetime" >}})
[Learn more about actor lifetimes.]({{% ref "actors-features-concepts#actor-lifetime" %}})
### Distribution and failover
To provide scalability and reliability, actors instances are throughout the cluster and Dapr distributes actor instances throughout the cluster and automatically migrates them to healthy nodes.
[Learn more about Dapr actor placement.]({{< ref "actors-features-concepts.md#actor-placement-service" >}})
[Learn more about Dapr actor placement.]({{% ref "actors-features-concepts#actor-placement-service" %}})
### Actor communication
@ -93,18 +93,18 @@ You can invoke actor methods by calling them over HTTP, as shown in the general
1. With the cached partitioning information from the placement service, the sidecar determines which actor service instance will host actor ID **3**. The call is forwarded to the appropriate sidecar.
1. The sidecar instance in pod 2 calls the service instance to invoke the actor and execute the actor method.
[Learn more about calling actor methods.]({{< ref "actors-features-concepts.md#actor-communication" >}})
[Learn more about calling actor methods.]({{% ref "actors-features-concepts#actor-communication" %}})
#### Concurrency
The Dapr actor runtime provides a simple turn-based access model for accessing actor methods. Turn-based access greatly simplifies concurrent systems as there is no need for synchronization mechanisms for data access.
- [Learn more about actor reentrancy]({{< ref "actor-reentrancy.md" >}})
- [Learn more about the turn-based access model]({{< ref "actors-features-concepts.md#turn-based-access" >}})
- [Learn more about actor reentrancy]({{% ref "actor-reentrancy" %}})
- [Learn more about the turn-based access model]({{% ref "actors-features-concepts#turn-based-access" %}})
### State
Transactional state stores can be used to store actor state. Regardless of whether you intend to store any state in your actor, you must specify a value for property `actorStateStore` as `true` in the state store component's metadata section. Actors state is stored with a specific scheme in transactional state stores, allowing for consistent querying. Only a single state store component can be used as the state store for all actors. Read the [state API reference]({{< ref state_api.md >}}) and the [actors API reference]({{< ref actors_api.md >}}) to learn more about state stores for actors.
Transactional state stores can be used to store actor state. Regardless of whether you intend to store any state in your actor, you must specify a value for property `actorStateStore` as `true` in the state store component's metadata section. Actors state is stored with a specific scheme in transactional state stores, allowing for consistent querying. Only a single state store component can be used as the state store for all actors. Read the [state API reference]({{% ref state_api %}}) and the [actors API reference]({{% ref actors_api %}}) to learn more about state stores for actors.
### Actor timers and reminders
@ -118,9 +118,9 @@ This distinction allows users to trade off between light-weight but stateless ti
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/0y7ne6teHT4?si=73VqYUUvNfFw3x5_&amp;start=12184" title="YouTube video player" style="padding-bottom:25px;" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
- [Learn more about actor timers.]({{< ref "actors-features-concepts.md#timers" >}})
- [Learn more about actor reminders.]({{< ref "actors-features-concepts.md#reminders" >}})
- [Learn more about timer and reminder error handling and failover.]({{< ref "actors-features-concepts.md#timers-and-reminders-error-handling" >}})
- [Learn more about actor timers.]({{% ref "actors-features-concepts#timers" %}})
- [Learn more about actor reminders.]({{% ref "actors-features-concepts#reminders" %}})
- [Learn more about timer and reminder error handling and failover.]({{% ref "actors-features-concepts#timers-and-reminders-error-handling" %}})
## Next steps
@ -128,5 +128,5 @@ This distinction allows users to trade off between light-weight but stateless ti
## Related links
- [Actors API reference]({{< ref actors_api.md >}})
- Refer to the [Dapr SDK documentation and examples]({{< ref "developing-applications/sdks/#sdk-languages" >}}).
- [Actors API reference]({{% ref actors_api %}})
- Refer to the [Dapr SDK documentation and examples]({{% ref "developing-applications/sdks/_index.md#sdk-languages" %}}).

View File

@ -21,9 +21,9 @@ You can modify the default Dapr actor runtime behavior using the following confi
## Examples
{{< tabs ".NET" JavaScript Python Java Go >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
// In Startup.cs
public void ConfigureServices(IServiceCollection services)
@ -59,11 +59,11 @@ public void ConfigureServices(IServiceCollection services)
services.AddSingleton<BankService>();
}
```
[See the .NET SDK documentation on registering actors]({{< ref "dotnet-actors-usage.md#registring-actors" >}}).
[See the .NET SDK documentation on registering actors]({{% ref "dotnet-actors-usage#registring-actors" %}}).
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
<!--javascript-->
@ -93,11 +93,11 @@ const server = new DaprServer(serverHost, serverPort, daprHost, daprPort, client
const client = new DaprClient(daprHost, daprPort, CommunicationProtocolEnum.HTTP, clientOptions);
```
[See the documentation on writing actors with the JavaScript SDK]({{< ref "js-actors.md#registering-actors" >}}).
[See the documentation on writing actors with the JavaScript SDK]({{% ref "js-actors#registering-actors" %}}).
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
<!--python-->
@ -117,11 +117,11 @@ ActorRuntime.set_actor_config(
)
```
[See the documentation on running actors with the Python SDK]({{< ref "python-actor.md" >}})
[See the documentation on running actors with the Python SDK]({{% ref "python-actor" %}})
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
<!--java-->
@ -137,11 +137,11 @@ ActorRuntime.getInstance().getConfig().setActorReentrancyConfig(false, null);
ActorRuntime.getInstance().getConfig().setRemindersStoragePartitions(7);
```
[See the documentation on writing actors with the Java SDK]({{< ref "java.md#actors" >}}).
[See the documentation on writing actors with the Java SDK]({{% ref "java#actors" %}}).
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
<!--go-->
```go
@ -191,12 +191,12 @@ func configHandler(w http.ResponseWriter, r *http.Request) {
[See an example for using actors with the Go SDK](https://github.com/dapr/go-sdk/tree/main/examples/actor).
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Related links
- Refer to the [Dapr SDK documentation and examples]({{< ref "developing-applications/sdks/#sdk-languages" >}}).
- [Actors API reference]({{< ref actors_api.md >}})
- [Actors overview]({{< ref actors-overview.md >}})
- Refer to the [Dapr SDK documentation and examples]({{% ref "developing-applications/sdks/_index.md#sdk-languages" %}}).
- [Actors API reference]({{% ref actors_api %}})
- [Actors overview]({{% ref actors-overview %}})

View File

@ -103,12 +103,12 @@ You can remove the actor timer by calling
DELETE http://localhost:3500/v1.0/actors/<actorType>/<actorId>/timers/<name>
```
Refer [api spec]({{< ref "actors_api.md#invoke-timer" >}}) for more details.
Refer [api spec]({{% ref "actors_api#invoke-timer" %}}) for more details.
## Actor reminders
{{% alert title="Note" color="primary" %}}
In Dapr v1.15, actor reminders are stored by default in the [Scheduler service]({{< ref "scheduler.md#actor-reminders" >}}). When upgrading to Dapr v1.15 all existing reminders are automatically migrated to the Scheduler service with no loss of reminders as a one time operation for each actor type.
In Dapr v1.15, actor reminders are stored by default in the [Scheduler service]({{% ref "scheduler#actor-reminders" %}}). When upgrading to Dapr v1.15 all existing reminders are automatically migrated to the Scheduler service with no loss of reminders as a one time operation for each actor type.
{{% /alert %}}
Reminders are a mechanism to trigger *persistent* callbacks on an actor at specified times. Their functionality is similar to timers. But unlike timers, reminders are triggered under all circumstances until the actor explicitly unregisters them or the actor is explicitly deleted or the number in invocations is exhausted. Specifically, reminders are triggered across actor deactivations and failovers because the Dapr actor runtime persists the information about the actors' reminders using Dapr actor state provider.
@ -119,7 +119,7 @@ You can create a persistent reminder for an actor by calling the HTTP/gRPC reque
POST/PUT http://localhost:3500/v1.0/actors/<actorType>/<actorId>/reminders/<name>
```
The request structure for reminders is identical to those of actors. Please refer to the [actor timers examples]({{< ref "#actor-timers" >}}).
The request structure for reminders is identical to those of actors. Please refer to the [actor timers examples]({{% ref "#actor-timers" %}}).
### Retrieve actor reminder
@ -139,9 +139,9 @@ DELETE http://localhost:3500/v1.0/actors/<actorType>/<actorId>/reminders/<name>
If an actor reminder is triggered and the app does not return a 2** code to the runtime (for example, because of a connection issue),
actor reminders will be retried up to three times with a backoff interval of one second between each attempt. There may be
additional retries attempted in accordance with any optionally applied [actor resiliency policy]({{< ref "override-default-retries.md" >}}).
additional retries attempted in accordance with any optionally applied [actor resiliency policy]({{% ref "override-default-retries" %}}).
Refer [api spec]({{< ref "actors_api.md#invoke-reminder" >}}) for more details.
Refer [api spec]({{% ref "actors_api#invoke-reminder" %}}) for more details.
## Error handling
@ -192,5 +192,5 @@ To use protobuf serialization for actor reminders on self-hosted, use the follow
## Related links
- [Actors API reference]({{< ref actors_api.md >}})
- [Actors overview]({{< ref actors-overview.md >}})
- [Actors API reference]({{% ref actors_api %}})
- [Actors overview]({{% ref actors-overview %}})

View File

@ -10,12 +10,12 @@ aliases:
{{% alert title="Warning" color="warning" %}}
This feature is only relevant when using state store actor reminders, no longer enabled by default.
As of v1.15, Dapr uses the far more performant [Scheduler Actor Reminders]({{< ref "scheduler.md#actor-reminders" >}}) by default.
This page is only relevant if you are using the legacy state store actor reminders, enabled via setting the [`SchedulerReminders` feature flag]({{< ref "support-preview-features.md#current-preview-features" >}}) to false.
As of v1.15, Dapr uses the far more performant [Scheduler Actor Reminders]({{% ref "scheduler#actor-reminders" %}}) by default.
This page is only relevant if you are using the legacy state store actor reminders, enabled via setting the [`SchedulerReminders` feature flag]({{% ref "support-preview-features#current-preview-features" %}}) to false.
It is highly recommended you use using the Scheduler Actor Reminders feature.
{{% /alert %}}
[Actor reminders]({{< ref "actors-timers-reminders.md#actor-reminders" >}}) are persisted and continue to be triggered after sidecar restarts. Applications with multiple reminders registered can experience the following issues:
[Actor reminders]({{% ref "actors-timers-reminders#actor-reminders" %}}) are persisted and continue to be triggered after sidecar restarts. Applications with multiple reminders registered can experience the following issues:
- Low throughput on reminders registration and de-registration
- Limited number of reminders registered based on the single record size limit on the state store
@ -37,9 +37,9 @@ If you need to change the number of partitions, Dapr's sidecar will automaticall
Similar to other actor configuration elements, the actor runtime provides the appropriate configuration to partition actor reminders via the actor's endpoint for `GET /dapr/config`. Select your preferred language for an actor runtime configuration example.
{{< tabs ".NET" JavaScript Python Java Go >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
<!--dotnet-->
@ -64,11 +64,11 @@ public void ConfigureServices(IServiceCollection services)
}
```
[See the .NET SDK documentation on registering actors]({{< ref "dotnet-actors-usage.md#registring-actors" >}}).
[See the .NET SDK documentation on registering actors]({{% ref "dotnet-actors-usage#registring-actors" %}}).
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
<!--javascript-->
```js
@ -96,11 +96,11 @@ await actor.registerActorReminder(
await actor.unregisterActorReminder("reminder-id");
```
[See the documentation on writing actors with the JavaScript SDK]({{< ref "js-actors.md#registering-actors" >}}).
[See the documentation on writing actors with the JavaScript SDK]({{% ref "js-actors#registering-actors" %}}).
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
<!--python-->
@ -116,11 +116,11 @@ ActorRuntime.set_actor_config(
)
```
[See the documentation on running actors with the Python SDK]({{< ref "python-actor.md" >}})
[See the documentation on running actors with the Python SDK]({{% ref "python-actor" %}})
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
<!--java-->
```java
@ -132,11 +132,11 @@ ActorRuntime.getInstance().getConfig().setActorScanInterval(Duration.ofSeconds(3
ActorRuntime.getInstance().getConfig().setRemindersStoragePartitions(7);
```
[See the documentation on writing actors with the Java SDK]({{< ref "java.md#actors" >}}).
[See the documentation on writing actors with the Java SDK]({{% ref "java#actors" %}}).
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
<!--go-->
```go
@ -167,9 +167,9 @@ func configHandler(w http.ResponseWriter, r *http.Request) {
[See an example for using actors with the Go SDK](https://github.com/dapr/go-sdk/tree/main/examples/actor).
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
The following is an example of a valid configuration for reminder partitioning:
@ -190,8 +190,7 @@ In addition, **you can only increase the number of partitions**, not decrease. T
Watch [this video for a demo of actor reminder partitioning](https://youtu.be/ZwFOEUYe1WA?t=1493):
<div class="embed-responsive embed-responsive-16by9">
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/ZwFOEUYe1WA?start=1495" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
{{< youtube id=ZwFOEUYe1WA start=1495 >}}
## Next steps
@ -199,5 +198,5 @@ Watch [this video for a demo of actor reminder partitioning](https://youtu.be/Zw
## Related links
- [Actors API reference]({{< ref actors_api.md >}})
- [Actors overview]({{< ref actors-overview.md >}})
- [Actors API reference]({{% ref actors_api %}})
- [Actors overview]({{% ref actors-overview %}})

View File

@ -18,10 +18,10 @@ POST/GET/PUT/DELETE http://localhost:3500/v1.0/actors/<actorType>/<actorId>/meth
Provide data for the actor method in the request body. The response for the request, which is data from actor method call, is in the response body.
Refer [to the Actors API spec]({{< ref "actors_api.md#invoke-actor-method" >}}) for more details.
Refer [to the Actors API spec]({{% ref "actors_api#invoke-actor-method" %}}) for more details.
{{% alert title="Note" color="primary" %}}
Alternatively, you can use [Dapr SDKs to use actors]({{< ref "developing-applications/sdks/#sdk-languages" >}}).
Alternatively, you can use [Dapr SDKs to use actors]({{% ref "developing-applications/sdks/#sdk-languages" %}}).
{{% /alert %}}
## Save state with actors
@ -30,7 +30,7 @@ You can interact with Dapr via HTTP/gRPC endpoints to save state reliably using
To use actors, your state store must support multi-item transactions. This means your state store component must implement the `TransactionalStore` interface.
[See the list of components that support transactions/actors]({{< ref supported-state-stores.md >}}). Only a single state store component can be used as the state store for all actors.
[See the list of components that support transactions/actors]({{% ref supported-state-stores %}}). Only a single state store component can be used as the state store for all actors.
## Next steps
@ -38,6 +38,6 @@ To use actors, your state store must support multi-item transactions. This means
## Related links
- Refer to the [Dapr SDK documentation and examples]({{< ref "developing-applications/sdks/#sdk-languages" >}}).
- [Actors API reference]({{< ref actors_api.md >}})
- [Actors overview]({{< ref actors-overview.md >}})
- Refer to the [Dapr SDK documentation and examples]({{% ref "developing-applications/sdks/_index.md#sdk-languages" %}}).
- [Actors API reference]({{% ref actors_api %}})
- [Actors overview]({{% ref actors-overview %}})

View File

@ -10,21 +10,21 @@ description: "Learn about namespaced actors"
Namespacing in Dapr provides isolation, and thus multi-tenancy. With actor namespacing, the same actor type can be deployed into different namespaces. You can call instances of these actors in the same namespace.
{{% alert title="Note" color="primary" %}}
Each namespaced actor deployment must use its own separate state store, especially if the same actor type is used across namespaces. In other words, no namespace information is written as part of the actor record, and hence separate state stores are required for each namespace. See [Configuring actor state stores for namespacing]({{< ref "#configuring-actor-state-stores-for-namespacing" >}}) section for examples.
Each namespaced actor deployment must use its own separate state store, especially if the same actor type is used across namespaces. In other words, no namespace information is written as part of the actor record, and hence separate state stores are required for each namespace. See [Configuring actor state stores for namespacing]({{% ref "#configuring-actor-state-stores-for-namespacing" %}}) section for examples.
{{% /alert %}}
## Creating and configuring namespaces
You can use namespaces either in self-hosted mode or on Kubernetes.
{{< tabs "Self-Hosted" "Kubernetes">}}
{{< tabpane text=true >}}
{{% codetab %}}
In self-hosted mode, you can specify the namespace for a Dapr instance by setting [the `NAMESPACE` environment variable]({{< ref environment.md >}}).
{{% tab "Self-Hosted" %}}
In self-hosted mode, you can specify the namespace for a Dapr instance by setting [the `NAMESPACE` environment variable]({{% ref environment %}}).
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Kubernetes" %}}
On Kubernetes, you can create and configure namepaces when deploying actor applications. For example, start with the following `kubectl` commands:
```bash
@ -34,9 +34,9 @@ kubectl config set-context --current --namespace=namespace-actorA
Then, deploy your actor applications into this namespace (in the example, `namespace-actorA`).
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Configuring actor state stores for namespacing
@ -113,12 +113,12 @@ auth:
secretStore: <SECRET_STORE_NAME>
```
Check your [state store component specs]({{< ref supported-state-stores.md >}}) to see what it provides.
Check your [state store component specs]({{% ref supported-state-stores %}}) to see what it provides.
{{% alert title="Note" color="primary" %}}
Namespaced actors use the multi-tenant Placement service. With this control plane service where each application deployment has its own namespace, sidecars belonging to an application in namespace "ActorA" won't receive placement information for an application in namespace "ActorB".
{{% /alert %}}
## Next steps
- [Learn more about the Dapr Placement service]({{< ref placement.md >}})
- [Placement API reference guide]({{< ref placement_api.md >}})
- [Learn more about the Dapr Placement service]({{% ref placement %}})
- [Placement API reference guide]({{% ref placement_api %}})

View File

@ -9,8 +9,8 @@ description: Interface with or be triggered from external systems
{{% alert title="More about Dapr Bindings" color="primary" %}}
Learn more about how to use Dapr Bindings:
- Try the [Bindings quickstart]({{< ref bindings-quickstart.md >}}).
- Explore input and output bindings via any of the supporting [Dapr SDKs]({{< ref sdks >}}).
- Review the [Bindings API reference documentation]({{< ref bindings_api.md >}}).
- Browse the supported [input and output bindings component specs]({{< ref supported-bindings >}}).
- Try the [Bindings quickstart]({{% ref bindings-quickstart %}}).
- Explore input and output bindings via any of the supporting [Dapr SDKs]({{% ref sdks %}}).
- Review the [Bindings API reference documentation]({{% ref bindings_api %}}).
- Browse the supported [input and output bindings component specs]({{% ref supported-bindings %}}).
{{% /alert %}}

View File

@ -29,7 +29,7 @@ In the above diagram:
Bindings are developed independently of Dapr runtime. You can [view and contribute to the bindings](https://github.com/dapr/components-contrib/tree/master/bindings).
{{% alert title="Note" color="primary" %}}
If you are using the HTTP Binding, then it is preferable to use [service invocation]({{< ref service_invocation_api.md >}}) instead. Read [How-To: Invoke Non-Dapr Endpoints using HTTP]({{< ref "howto-invoke-non-dapr-endpoints.md" >}}) for more information.
If you are using the HTTP Binding, then it is preferable to use [service invocation]({{% ref service_invocation_api %}}) instead. Read [How-To: Invoke Non-Dapr Endpoints using HTTP]({{% ref "howto-invoke-non-dapr-endpoints" %}}) for more information.
{{% /alert %}}
## Input bindings
@ -38,7 +38,7 @@ With input bindings, you can trigger your application when an event from an exte
[The following overview video and demo](https://www.youtube.com/live/0y7ne6teHT4?si=wlmAi7BJBWS8KNK7&t=8261) demonstrates how Dapr input binding works.
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/0y7ne6teHT4?si=wlmAi7BJBWS8KNK7&amp;start=8261" title="YouTube video player" style="padding-bottom:25px;" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
{{< youtube id=0y7ne6teHT4 start=8261 >}}
To receive events from an input binding:
@ -48,11 +48,11 @@ To receive events from an input binding:
- The gRPC proto library to get incoming events.
{{% alert title="Note" color="primary" %}}
On startup, Dapr sends [an OPTIONS request]({{< ref "bindings_api.md#invoking-service-code-through-input-bindings" >}}) for all defined input bindings to the application. If the application wants to subscribe to the binding, Dapr expects a status code of 2xx or 405.
On startup, Dapr sends [an OPTIONS request]({{% ref "bindings_api#invoking-service-code-through-input-bindings" %}}) for all defined input bindings to the application. If the application wants to subscribe to the binding, Dapr expects a status code of 2xx or 405.
{{% /alert %}}
Read the [Create an event-driven app using input bindings guide]({{< ref howto-triggers.md >}}) to get started with input bindings.
Read the [Create an event-driven app using input bindings guide]({{% ref howto-triggers %}}) to get started with input bindings.
## Output bindings
@ -72,7 +72,7 @@ To invoke an output binding:
- `"delete"`
- `"exec"`
Read the [Use output bindings to interface with external resources guide]({{< ref howto-bindings.md >}}) to get started with output bindings.
Read the [Use output bindings to interface with external resources guide]({{% ref howto-bindings %}}) to get started with output bindings.
## Binding directions (optional)
@ -86,7 +86,7 @@ You can provide the `direction` metadata field to indicate the direction(s) supp
It is highly recommended that all input bindings should include the `direction` property.
{{% /alert %}}
[See a full example of the bindings `direction` metadata.]({{< ref "bindings_api.md#binding-direction-optional" >}})
[See a full example of the bindings `direction` metadata.]({{% ref "bindings_api#binding-direction-optional" %}})
## Try out bindings
@ -96,17 +96,17 @@ Want to put the Dapr bindings API to the test? Walk through the following quicks
| Quickstart/tutorial | Description |
| ------------------- | ----------- |
| [Bindings quickstart]({{< ref bindings-quickstart.md >}}) | Work with external systems using input bindings to respond to events and output bindings to call operations. |
| [Bindings quickstart]({{% ref bindings-quickstart %}}) | Work with external systems using input bindings to respond to events and output bindings to call operations. |
| [Bindings tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/bindings) | Demonstrates how to use Dapr to create input and output bindings to other components. Uses bindings to Kafka. |
### Start using bindings directly in your app
Want to skip the quickstarts? Not a problem. You can try out the bindings building block directly in your application to invoke output bindings and trigger input bindings. After [Dapr is installed]({{< ref "getting-started/_index.md" >}}), you can begin using the bindings API starting with [the input bindings how-to guide]({{< ref howto-triggers.md >}}).
Want to skip the quickstarts? Not a problem. You can try out the bindings building block directly in your application to invoke output bindings and trigger input bindings. After [Dapr is installed]({{% ref "getting-started/_index.md" %}}), you can begin using the bindings API starting with [the input bindings how-to guide]({{% ref howto-triggers %}}).
## Next Steps
- Follow these guides on:
- [How-To: Trigger a service from different resources with input bindings]({{< ref howto-triggers.md >}})
- [How-To: Use output bindings to interface with external resources]({{< ref howto-bindings.md >}})
- [How-To: Trigger a service from different resources with input bindings]({{% ref howto-triggers %}})
- [How-To: Use output bindings to interface with external resources]({{% ref howto-bindings %}})
- Try out the [bindings tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/bindings/README.md) to experiment with binding to a Kafka queue.
- Read the [bindings API specification]({{< ref bindings_api.md >}})
- Read the [bindings API specification]({{% ref bindings_api %}})

View File

@ -11,15 +11,15 @@ With output bindings, you can invoke external resources. An optional payload and
<img src="/images/howto-bindings/kafka-output-binding.png" width=1000 alt="Diagram showing bindings of example service">
This guide uses a Kafka binding as an example. You can find your preferred binding spec from [the list of bindings components]({{< ref setup-bindings >}}). In this guide:
This guide uses a Kafka binding as an example. You can find your preferred binding spec from [the list of bindings components]({{% ref setup-bindings %}}). In this guide:
1. The example invokes the `/binding` endpoint with `checkout`, the name of the binding to invoke.
1. The payload goes inside the mandatory `data` field, and can be any JSON serializable value.
1. The `operation` field tells the binding what action it needs to take. For example, [the Kafka binding supports the `create` operation]({{< ref "kafka.md#binding-support" >}}).
- You can check [which operations (specific to each component) are supported for every output binding]({{< ref supported-bindings >}}).
1. The `operation` field tells the binding what action it needs to take. For example, [the Kafka binding supports the `create` operation]({{% ref "kafka#binding-support" %}}).
- You can check [which operations (specific to each component) are supported for every output binding]({{% ref supported-bindings %}}).
{{% alert title="Note" color="primary" %}}
If you haven't already, [try out the bindings quickstart]({{< ref bindings-quickstart.md >}}) for a quick walk-through on how to use the bindings API.
If you haven't already, [try out the bindings quickstart]({{% ref bindings-quickstart %}}) for a quick walk-through on how to use the bindings API.
{{% /alert %}}
@ -32,11 +32,11 @@ Create a new binding component named `checkout`. Within the `metadata` section,
- The topic to which you'll publish the message
- The broker
When creating the binding component, [specify the supported `direction` of the binding]({{< ref "bindings_api.md#binding-direction-optional" >}}).
When creating the binding component, [specify the supported `direction` of the binding]({{% ref "bindings_api#binding-direction-optional" %}}).
{{< tabs "Self-Hosted (CLI)" Kubernetes >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Self-Hosted (CLI)" %}}
Use the `--resources-path` flag with `dapr run` to point to your custom resources directory.
@ -66,9 +66,9 @@ spec:
value: output
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Kubernetes" %}}
To deploy the following `binding.yaml` file into a Kubernetes cluster, run `kubectl apply -f binding.yaml`.
@ -98,17 +98,19 @@ spec:
value: output
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Send an event (output binding)
The code examples below leverage Dapr SDKs to invoke the output bindings endpoint on a running Dapr instance.
{{< tabs ".NET" Java Python Go JavaScript>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
Here's an example of using a console app with top-level statements in .NET 6+:
Here's an example of using a console app with top-level statements in .NET 6+:
@ -136,9 +138,9 @@ while (true)
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
//dependencies
@ -174,9 +176,9 @@ public class OrderProcessingServiceApplication {
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
@ -202,9 +204,9 @@ while True:
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
//dependencies
@ -240,9 +242,9 @@ func main() {
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript%}}" %}}
```javascript
//dependencies
@ -282,9 +284,9 @@ function sleep(ms) {
}
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
You can also invoke the output bindings endpoint using HTTP:
@ -294,12 +296,10 @@ curl -X POST -H 'Content-Type: application/json' http://localhost:3601/v1.0/bind
Watch this [video](https://www.youtube.com/watch?v=ysklxm81MTs&feature=youtu.be&t=1960) on how to use bi-directional output bindings.
<div class="embed-responsive embed-responsive-16by9">
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/ysklxm81MTs?start=1960" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{< youtube id=ysklxm81MTs start=1960 >}}
## References
- [Binding API]({{< ref bindings_api.md >}})
- [Binding components]({{< ref bindings >}})
- [Binding detailed specifications]({{< ref supported-bindings >}})
- [Binding API]({{% ref bindings_api %}})
- [Binding components]({{% ref bindings %}})
- [Binding detailed specifications]({{% ref supported-bindings %}})

View File

@ -16,15 +16,15 @@ Input bindings are ideal for event-driven processing, data pipelines, or general
<img src="/images/howto-triggers/kafka-input-binding.png" width=1000 alt="Diagram showing bindings of example service">
This guide uses a Kafka binding as an example. You can find your preferred binding spec from [the list of bindings components]({{< ref setup-bindings >}}). In this guide:
This guide uses a Kafka binding as an example. You can find your preferred binding spec from [the list of bindings components]({{% ref setup-bindings %}}). In this guide:
1. The example invokes the `/binding` endpoint with `checkout`, the name of the binding to invoke.
1. The payload goes inside the mandatory `data` field, and can be any JSON serializable value.
1. The `operation` field tells the binding what action it needs to take. For example, [the Kafka binding supports the `create` operation]({{< ref "kafka.md#binding-support" >}}).
- You can check [which operations (specific to each component) are supported for every output binding]({{< ref supported-bindings >}}).
1. The `operation` field tells the binding what action it needs to take. For example, [the Kafka binding supports the `create` operation]({{% ref "kafka#binding-support" %}}).
- You can check [which operations (specific to each component) are supported for every output binding]({{% ref supported-bindings %}}).
{{% alert title="Note" color="primary" %}}
If you haven't already, [try out the bindings quickstart]({{< ref bindings-quickstart.md >}}) for a quick walk-through on how to use the bindings API.
If you haven't already, [try out the bindings quickstart]({{% ref bindings-quickstart %}}) for a quick walk-through on how to use the bindings API.
{{% /alert %}}
@ -37,11 +37,11 @@ Create a new binding component named `checkout`. Within the `metadata` section,
- The topic to which you'll publish the message
- The broker
When creating the binding component, [specify the supported `direction` of the binding]({{< ref "bindings_api.md#binding-direction-optional" >}}).
When creating the binding component, [specify the supported `direction` of the binding]({{% ref "bindings_api#binding-direction-optional" %}}).
{{< tabs "Self-Hosted (CLI)" Kubernetes >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Self-Hosted (CLI)" %}}
Use the `--resources-path` flag with the `dapr run` command to point to your custom resources directory.
@ -71,9 +71,9 @@ spec:
value: input
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Kubernetes" %}}
To deploy into a Kubernetes cluster, run `kubectl apply -f binding.yaml`.
@ -103,9 +103,9 @@ spec:
value: input
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Listen for incoming events (input binding)
@ -115,9 +115,11 @@ Configure your application to receive incoming events. If you're using HTTP, you
Below are code examples that leverage Dapr SDKs to demonstrate an input binding.
{{< tabs ".NET" Java Python Go JavaScript>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
The following example demonstrates how to configure an input binding using ASP.NET Core controllers.
The following example demonstrates how to configure an input binding using ASP.NET Core controllers.
@ -150,9 +152,9 @@ app.MapPost("checkout", ([FromBody] int orderId) =>
});
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
//dependencies
@ -175,9 +177,9 @@ public class CheckoutServiceController {
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
@ -196,9 +198,9 @@ app.run(6002)
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
//dependencies
@ -230,9 +232,9 @@ func main() {
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript%}}" %}}
```javascript
//dependencies
@ -265,9 +267,9 @@ async function start() {
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
### ACK an event
@ -296,7 +298,7 @@ Event delivery guarantees are controlled by the binding implementation. Dependin
## References
- [Bindings building block]({{< ref bindings >}})
- [Bindings API]({{< ref bindings_api.md >}})
- [Components concept]({{< ref components-concept.md >}})
- [Supported bindings]({{< ref supported-bindings >}})
- [Bindings building block]({{% ref bindings %}})
- [Bindings API]({{% ref bindings_api %}})
- [Components concept]({{% ref components-concept %}})
- [Supported bindings]({{% ref supported-bindings %}})

View File

@ -8,8 +8,8 @@ description: Manage and be notified of application configuration changes
{{% alert title="More about Dapr Configuration" color="primary" %}}
Learn more about how to use Dapr Configuration:
- Try the [Configuration quickstart]({{< ref configuration-quickstart.md >}}).
- Explore configuration via any of the supporting [Dapr SDKs]({{< ref sdks >}}).
- Review the [Configuration API reference documentation]({{< ref configuration_api.md >}}).
- Browse the supported [configuration component specs]({{< ref supported-configuration-stores >}}).
- Try the [Configuration quickstart]({{% ref configuration-quickstart %}}).
- Explore configuration via any of the supporting [Dapr SDKs]({{% ref sdks %}}).
- Review the [Configuration API reference documentation]({{% ref configuration_api %}}).
- Browse the supported [configuration component specs]({{% ref supported-configuration-stores %}}).
{{% /alert %}}

View File

@ -23,7 +23,7 @@ Configuration data is read-only from the application API perspective, with updat
<img src="/images/configuration-api-overview.png" width=900>
{{% alert title="Note" color="primary" %}}
The Configuration API should not be confused with the [Dapr sidecar and control plane configuration]({{< ref "configuration-overview" >}}), which is used to set policies and settings on Dapr sidecar instances or the installed Dapr control plane.
The Configuration API should not be confused with the [Dapr sidecar and control plane configuration]({{% ref "configuration-overview" %}}), which is used to set policies and settings on Dapr sidecar instances or the installed Dapr control plane.
{{% /alert %}}
## Try out configuration
@ -34,19 +34,19 @@ Want to put the Dapr configuration API to the test? Walk through the following q
| Quickstart | Description |
| ---------- | ----------- |
| [Configuration quickstart]({{< ref configuration-quickstart.md >}}) | Get configuration items or subscribe to configuration changes using the configuration API. |
| [Configuration quickstart]({{% ref configuration-quickstart %}}) | Get configuration items or subscribe to configuration changes using the configuration API. |
### Start using the configuration API directly in your app
Want to skip the quickstarts? Not a problem. You can try out the configuration building block directly in your application to read and manage configuration data. After [Dapr is installed]({{< ref "getting-started/_index.md" >}}), you can begin using the configuration API starting with [the configuration how-to guide]({{< ref howto-manage-configuration.md >}}).
Want to skip the quickstarts? Not a problem. You can try out the configuration building block directly in your application to read and manage configuration data. After [Dapr is installed]({{% ref "getting-started/_index.md" %}}), you can begin using the configuration API starting with [the configuration how-to guide]({{% ref howto-manage-configuration %}}).
## Watch the demo
Watch [this demo of using the Dapr Configuration building block](https://youtu.be/tNq-n1XQuLA?t=496)
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/tNq-n1XQuLA?start=496" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
{{< youtube id=tNq-n1XQuLA start=496 >}}
## Next steps
Follow these guides on:
- [How-To: Read application configuration from a configuration store]({{< ref howto-manage-configuration.md >}})
- [How-To: Read application configuration from a configuration store]({{% ref howto-manage-configuration %}})

View File

@ -11,7 +11,7 @@ This example uses the Redis configuration store component to demonstrate how to
<img src="/images/building-block-configuration-example.png" width=1000 alt="Diagram showing get configuration of example service">
{{% alert title="Note" color="primary" %}}
If you haven't already, [try out the configuration quickstart]({{< ref configuration-quickstart.md >}}) for a quick walk-through on how to use the configuration API.
If you haven't already, [try out the configuration quickstart]({{% ref configuration-quickstart %}}) for a quick walk-through on how to use the configuration API.
{{% /alert %}}
@ -42,7 +42,7 @@ MSET orderId1 "101||1" orderId2 "102||1"
## Configure a Dapr configuration store
Save the following component file to the [default components folder]({{< ref "install-dapr-selfhost.md#step-5-verify-components-directory-has-been-initialized" >}}) on your machine. You can use this as the Dapr component YAML:
Save the following component file to the [default components folder]({{% ref "install-dapr-selfhost#step-5-verify-components-directory-has-been-initialized" %}}) on your machine. You can use this as the Dapr component YAML:
- For Kubernetes using `kubectl`.
- When running with the Dapr CLI.
@ -71,9 +71,9 @@ spec:
The following example shows how to get a saved configuration item using the Dapr Configuration API.
{{< tabs ".NET" Java Python Go JavaScript "HTTP API (BASH)" "HTTP API (Powershell)">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using System;
@ -93,9 +93,9 @@ var configuration = await client.GetConfiguration(CONFIG_STORE_NAME, [ "orderId1
Console.WriteLine($"Got key=\n{configuration[0].Key} -> {configuration[0].Value}\n{configuration[1].Key} -> {configuration[1].Value}");
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
//dependencies
@ -126,9 +126,9 @@ public static void main(String[] args) throws Exception {
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
@ -143,9 +143,9 @@ with DaprClient() as d:
print(f"Got key={configuration.items[0].key} value={configuration.items[0].value} version={configuration.items[0].version}")
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
package main
@ -173,9 +173,9 @@ func main() {
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```js
import { CommunicationProtocolEnum, DaprClient } from "@dapr/dapr";
@ -205,9 +205,9 @@ async function main() {
main().catch((e) => console.error(e));
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (BASH)" %}}
Launch a dapr sidecar:
@ -221,9 +221,9 @@ In a separate terminal, get the configuration item saved earlier:
curl http://localhost:3601/v1.0/configuration/configstore?key=orderId1
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
Launch a Dapr sidecar:
@ -237,18 +237,18 @@ In a separate terminal, get the configuration item saved earlier:
Invoke-RestMethod -Uri 'http://localhost:3601/v1.0/configuration/configstore?key=orderId1'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
### Subscribe to configuration item updates
Below are code examples that leverage SDKs to subscribe to keys `[orderId1, orderId2]` using `configstore` store component.
{{< tabs ".NET" "ASP.NET Core" Java Python Go JavaScript>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using System;
@ -290,9 +290,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id orderprocessing -- dotnet run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "ASP.NET" %}}
```csharp
using System;
@ -328,9 +328,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id orderprocessing -- dotnet run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
import io.dapr.client.DaprClientBuilder;
@ -375,9 +375,9 @@ Navigate to the directory containing the above code, then run the following comm
```bash
dapr run --app-id orderprocessing -- -- mvn spring-boot:run
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
@ -408,9 +408,9 @@ Navigate to the directory containing the above code, then run the following com
dapr run --app-id orderprocessing -- python3 OrderProcessingService.py
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
package main
@ -447,9 +447,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id orderprocessing -- go run main.go
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```js
import { CommunicationProtocolEnum, DaprClient } from "@dapr/dapr";
@ -493,9 +493,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id orderprocessing --app-protocol grpc --dapr-grpc-port 3500 -- node index.js
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
### Unsubscribe from configuration item updates
@ -504,9 +504,9 @@ After you've subscribed to watch configuration items, you will receive updates f
Following are the code examples showing how you can unsubscribe to configuration updates using unsubscribe API.
{{< tabs ".NET" Java Python Go JavaScript "HTTP API (BASH)" "HTTP API (Powershell)">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using System;
@ -525,9 +525,9 @@ var client = app.Services.GetRequiredService<DaprClient>();
await client.UnsubscribeConfiguration(DAPR_CONFIGURATION_STORE, SubscriptionId);
Console.WriteLine("App unsubscribed from config changes");
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
import io.dapr.client.DaprClientBuilder;
import io.dapr.client.DaprClient;
@ -557,9 +557,9 @@ public static void main(String[] args) throws Exception {
}
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
import asyncio
import time
@ -571,9 +571,9 @@ with DaprClient() as d:
isSuccess = d.unsubscribe_configuration(store_name='configstore', id=subscriptionID)
print(f"Unsubscribed successfully? {isSuccess}", flush=True)
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
package main
@ -603,9 +603,9 @@ func main() {
}
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```js
import { CommunicationProtocolEnum, DaprClient } from "@dapr/dapr";
@ -642,22 +642,22 @@ async function main() {
main().catch((e) => console.error(e));
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (BASH)" %}}
```bash
curl 'http://localhost:<DAPR_HTTP_PORT>/v1.0/configuration/configstore/<subscription-id>/unsubscribe'
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
```powershell
Invoke-RestMethod -Uri 'http://localhost:<DAPR_HTTP_PORT>/v1.0/configuration/configstore/<subscription-id>/unsubscribe'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Next steps
* Read [configuration API overview]({{< ref configuration-api-overview.md >}})
* Read [configuration API overview]({{% ref configuration-api-overview %}})

View File

@ -7,14 +7,14 @@ description: "Overview of the conversation API building block"
---
{{% alert title="Alpha" color="primary" %}}
The conversation API is currently in [alpha]({{< ref "certification-lifecycle.md#certification-levels" >}}).
The conversation API is currently in [alpha]({{% ref "certification-lifecycle#certification-levels" %}}).
{{% /alert %}}
Dapr's conversation API reduces the complexity of securely and reliably interacting with Large Language Models (LLM) at scale. Whether you're a developer who doesn't have the necessary native SDKs or a polyglot shop who just wants to focus on the prompt aspects of LLM interactions, the conversation API provides one consistent API entry point to talk to underlying LLM providers.
<img src="/images/conversation-overview.png" width=800 alt="Diagram showing the flow of a user's app communicating with Dapr's LLM components.">
In additon to enabling critical performance and security functionality (like [prompt caching]({{< ref "#prompt-caching" >}}) and [PII scrubbing]({{< ref "#personally-identifiable-information-pii-obfuscation" >}})), you can also pair the conversation API with Dapr functionalities, like:
In additon to enabling critical performance and security functionality (like [prompt caching]({{% ref "#prompt-caching" %}}) and [PII scrubbing]({{% ref "#personally-identifiable-information-pii-obfuscation" %}})), you can also pair the conversation API with Dapr functionalities, like:
- Resiliency circuit breakers and retries to circumvent limit and token errors, or
- Middleware to authenticate requests coming to and from the LLM
@ -22,7 +22,7 @@ Dapr provides observability by issuing metrics for your LLM interactions.
## Features
The following features are out-of-the-box for [all the supported conversation components]({{< ref supported-conversation >}}).
The following features are out-of-the-box for [all the supported conversation components]({{% ref supported-conversation %}}).
### Prompt caching
@ -49,7 +49,7 @@ The PII scrubber obfuscates the following user information:
Watch the demo presented during [Diagrid's Dapr v1.15 celebration](https://www.diagrid.io/videos/dapr-1-15-deep-dive) to see how the conversation API works using the .NET SDK.
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/NTnwoDhHIcQ?si=37SDcOHtEpgCIwkG&amp;start=5444" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
{{< youtube id=NTnwoDhHIcQ start=5444 >}}
## Try out conversation
@ -59,13 +59,13 @@ Want to put the Dapr conversation API to the test? Walk through the following qu
| Quickstart/tutorial | Description |
| ------------------- | ----------- |
| [Conversation quickstart]({{< ref conversation-quickstart.md >}}) | Learn how to interact with Large Language Models (LLMs) using the conversation API. |
| [Conversation quickstart]({{% ref conversation-quickstart %}}) | Learn how to interact with Large Language Models (LLMs) using the conversation API. |
### Start using the conversation API directly in your app
Want to skip the quickstarts? Not a problem. You can try out the conversation building block directly in your application. After [Dapr is installed]({{< ref "getting-started/_index.md" >}}), you can begin using the conversation API starting with [the how-to guide]({{< ref howto-conversation-layer.md >}}).
Want to skip the quickstarts? Not a problem. You can try out the conversation building block directly in your application. After [Dapr is installed]({{% ref "getting-started/_index.md" %}}), you can begin using the conversation API starting with [the how-to guide]({{% ref howto-conversation-layer %}}).
## Next steps
- [How-To: Converse with an LLM using the conversation API]({{< ref howto-conversation-layer.md >}})
- [Conversation API components]({{< ref supported-conversation >}})
- [How-To: Converse with an LLM using the conversation API]({{% ref howto-conversation-layer %}})
- [Conversation API components]({{% ref supported-conversation %}})

View File

@ -7,10 +7,10 @@ description: "Learn how to abstract the complexities of interacting with large l
---
{{% alert title="Alpha" color="primary" %}}
The conversation API is currently in [alpha]({{< ref "certification-lifecycle.md#certification-levels" >}}).
The conversation API is currently in [alpha]({{% ref "certification-lifecycle#certification-levels" %}}).
{{% /alert %}}
Let's get started using the [conversation API]({{< ref conversation-overview.md >}}). In this guide, you'll learn how to:
Let's get started using the [conversation API]({{% ref conversation-overview %}}). In this guide, you'll learn how to:
- Set up one of the available Dapr components (echo) that work with the conversation API.
- Add the conversation client to your application.
@ -20,7 +20,7 @@ Let's get started using the [conversation API]({{< ref conversation-overview.md
Create a new configuration file called `conversation.yaml` and save to a components or config sub-folder in your application directory.
Select your [preferred conversation component spec]({{< ref supported-conversation >}}) for your `conversation.yaml` file.
Select your [preferred conversation component spec]({{% ref supported-conversation %}}) for your `conversation.yaml` file.
For this scenario, we use a simple echo component.
@ -36,7 +36,7 @@ spec:
### Use the OpenAI component
To interface with a real LLM, use one of the other [supported conversation components]({{< ref "supported-conversation" >}}), including OpenAI, Hugging Face, Anthropic, DeepSeek, and more.
To interface with a real LLM, use one of the other [supported conversation components]({{% ref "supported-conversation" %}}), including OpenAI, Hugging Face, Anthropic, DeepSeek, and more.
For example, to swap out the `echo` mock component with an `OpenAI` component, replace the `conversation.yaml` file with the following. You'll need to copy your API key into the component file.
@ -56,13 +56,13 @@ spec:
## Connect the conversation client
The following examples use an HTTP client to send a POST request to Dapr's sidecar HTTP endpoint. You can also use [the Dapr SDK client instead]({{< ref "#related-links" >}}).
The following examples use an HTTP client to send a POST request to Dapr's sidecar HTTP endpoint. You can also use [the Dapr SDK client instead]({{% ref "#related-links" %}}).
{{< tabs ".NET" "Go" "Rust" >}}
{{< tabpane text=true >}}
<!-- .NET -->
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using Dapr.AI.Conversation;
@ -90,10 +90,10 @@ foreach (var resp in response.Outputs)
}
```
{{% /codetab %}}
{{% /tab %}}
<!-- Go -->
{{% codetab %}}
{{% tab "Go" %}}
```go
package main
@ -132,10 +132,10 @@ func main() {
}
```
{{% /codetab %}}
{{% /tab %}}
<!-- Rust -->
{{% codetab %}}
{{% tab "Rust" %}}
```rust
use dapr::client::{ConversationInputBuilder, ConversationRequestBuilder};
@ -170,27 +170,27 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
}
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Run the conversation connection
Start the connection using the `dapr run` command. For example, for this scenario, we're running `dapr run` on an application with the app ID `conversation` and pointing to our conversation YAML file in the `./config` directory.
{{< tabs ".NET" "Go" "Rust" >}}
{{< tabpane text=true >}}
<!-- .NET -->
{{% codetab %}}
{{% tab ".NET" %}}
```bash
dapr run --app-id conversation --dapr-grpc-port 50001 --log-level debug --resources-path ./config -- dotnet run
```
{{% /codetab %}}
{{% /tab %}}
<!-- Go -->
{{% codetab %}}
{{% tab "Go" %}}
```bash
dapr run --app-id conversation --dapr-grpc-port 50001 --log-level debug --resources-path ./config -- go run ./main.go
@ -202,10 +202,10 @@ dapr run --app-id conversation --dapr-grpc-port 50001 --log-level debug --resour
- '== APP == conversation output: Please write a witty haiku about the Dapr distributed programming framework at dapr.io'
```
{{% /codetab %}}
{{% /tab %}}
<!-- Rust -->
{{% codetab %}}
{{% tab "Rust" %}}
```bash
dapr run --app-id=conversation --resources-path ./config --dapr-grpc-port 3500 -- cargo run --example conversation
@ -218,9 +218,9 @@ dapr run --app-id=conversation --resources-path ./config --dapr-grpc-port 3500 -
- 'conversation output: hello world'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Advanced features
@ -230,40 +230,40 @@ The conversation API supports the following features:
1. **PII scrubbing:** Allows for the obfuscation of data going in and out of the LLM.
To learn how to enable these features, see the [conversation API reference guide]({{< ref conversation_api.md >}}).
To learn how to enable these features, see the [conversation API reference guide]({{% ref conversation_api %}}).
## Related links
Try out the conversation API using the full examples provided in the supported SDK repos.
{{< tabs ".NET" "Go" "Rust" >}}
{{< tabpane text=true >}}
<!-- .NET -->
{{% codetab %}}
{{% tab ".NET" %}}
[Dapr conversation example with the .NET SDK](https://github.com/dapr/dotnet-sdk/tree/master/examples/AI/ConversationalAI)
{{% /codetab %}}
{{% /tab %}}
<!-- Go -->
{{% codetab %}}
{{% tab "Go" %}}
[Dapr conversation example with the Go SDK](https://github.com/dapr/go-sdk/tree/main/examples/conversation)
{{% /codetab %}}
{{% /tab %}}
<!-- Rust -->
{{% codetab %}}
{{% tab "Rust" %}}
[Dapr conversation example with the Rust SDK](https://github.com/dapr/rust-sdk/tree/main/examples/src/conversation)
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Next steps
- [Conversation API reference guide]({{< ref conversation_api.md >}})
- [Available conversation components]({{< ref supported-conversation >}})
- [Conversation API reference guide]({{% ref conversation_api %}})
- [Available conversation components]({{% ref supported-conversation %}})

View File

@ -8,7 +8,7 @@ description: "Perform cryptographic operations without exposing keys to your app
{{% alert title="More about Dapr Cryptography" color="primary" %}}
Learn more about how to use Dapr Cryptography:
- Try the [Cryptography quickstart]({{< ref cryptography-quickstart.md >}}).
- Explore cryptography via any of the supporting [Dapr SDKs]({{< ref sdks >}}).
- Browse the supported [cryptography component specs]({{< ref supported-cryptography >}}).
- Try the [Cryptography quickstart]({{% ref cryptography-quickstart %}}).
- Explore cryptography via any of the supporting [Dapr SDKs]({{% ref sdks %}}).
- Browse the supported [cryptography component specs]({{% ref supported-cryptography %}}).
{{% /alert %}}

View File

@ -67,23 +67,23 @@ Want to put the Dapr cryptography API to the test? Walk through the following qu
| Quickstart/tutorial | Description |
| ------------------- | ----------- |
| [Cryptography quickstart]({{< ref cryptography-quickstart.md >}}) | Encrypt and decrypt messages and large files using RSA and AES keys with the cryptography API. |
| [Cryptography quickstart]({{% ref cryptography-quickstart %}}) | Encrypt and decrypt messages and large files using RSA and AES keys with the cryptography API. |
### Start using cryptography directly in your app
Want to skip the quickstarts? Not a problem. You can try out the cryptography building block directly in your application to encrypt and decrypt your application. After [Dapr is installed]({{< ref "getting-started/_index.md" >}}), you can begin using the cryptography API starting with [the cryptography how-to guide]({{< ref howto-cryptography.md >}}).
Want to skip the quickstarts? Not a problem. You can try out the cryptography building block directly in your application to encrypt and decrypt your application. After [Dapr is installed]({{% ref "getting-started/_index.md" %}}), you can begin using the cryptography API starting with [the cryptography how-to guide]({{% ref howto-cryptography %}}).
## Demo
Watch this [demo video of the Cryptography API from the Dapr Community Call #83](https://youtu.be/PRWYX4lb2Sg?t=1148):
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/PRWYX4lb2Sg?start=1148" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
{{< youtube id=PRWYX4lb2Sg start=1148 >}}
## Next steps
{{< button text="Use the cryptography API >>" page="howto-cryptography.md" >}}
## Related links
- [Cryptography overview]({{< ref cryptography-overview.md >}})
- [Cryptography component specs]({{< ref supported-cryptography >}})
- [Cryptography API reference doc]({{< ref cryptography_api >}})
- [Cryptography overview]({{% ref cryptography-overview %}})
- [Cryptography component specs]({{% ref supported-cryptography %}})
- [Cryptography API reference doc]({{% ref cryptography_api %}})

View File

@ -6,7 +6,7 @@ weight: 2000
description: "Learn how to encrypt and decrypt files"
---
Now that you've read about [Cryptography as a Dapr building block]({{< ref cryptography-overview.md >}}), let's walk through using the cryptography APIs with the SDKs.
Now that you've read about [Cryptography as a Dapr building block]({{% ref cryptography-overview %}}), let's walk through using the cryptography APIs with the SDKs.
{{% alert title="Note" color="primary" %}}
Dapr cryptography is currently in alpha.
@ -15,9 +15,9 @@ Dapr cryptography is currently in alpha.
## Encrypt
{{< tabs "Python" "JavaScript" ".NET" "Go" >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Python" %}}
<!--Python-->
@ -47,9 +47,9 @@ def encrypt_decrypt_string(dapr: DaprClient):
print(f'Encrypted the message, got {len(encrypt_bytes)} bytes')
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
<!--JavaScript-->
@ -87,9 +87,9 @@ await pipeline(
);
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
<!-- .NET -->
Using the Dapr SDK in your project, with the gRPC APIs, you can encrypt data in a string or a byte array:
@ -107,9 +107,9 @@ var plainTextBytes = Encoding.UTF8.GetBytes(plainText);
var encryptedBytesResult = await client.EncryptAsync(componentName, plaintextBytes, keyName, new EncryptionOptions(KeyWrapAlgorithm.Rsa));
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
<!--go-->
@ -186,16 +186,16 @@ if err != nil {
}
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Decrypt
{{< tabs "Python" "JavaScript" ".NET" "Go" >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Python" %}}
<!--python-->
@ -226,9 +226,9 @@ def encrypt_decrypt_string(dapr: DaprClient):
assert message == decrypt_bytes.decode()
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
<!--JavaScript-->
@ -252,9 +252,9 @@ await pipeline(
);
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
<!-- .NET -->
To decrypt a string, use the 'DecryptAsync' gRPC API in your project.
@ -275,9 +275,9 @@ public async Task<string> DecryptBytesAsync(byte[] encryptedBytes)
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
<!--go-->
@ -292,9 +292,9 @@ out, err := sdkClient.Decrypt(context.Background(), rf, dapr.EncryptOptions{
})
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Next steps
[Cryptography component specs]({{< ref supported-cryptography >}})
[Cryptography component specs]({{% ref supported-cryptography %}})

View File

@ -8,7 +8,7 @@ description: Distributed locks provide mutually exclusive access to shared resou
{{% alert title="More about Dapr Distributed Lock" color="primary" %}}
Learn more about how to use Dapr Distributed Lock:
- Explore distributed locks via any of the supporting [Dapr SDKs]({{< ref sdks >}}).
- Review the [Distributed Lock API reference documentation]({{< ref distributed_lock_api.md >}}).
- Browse the supported [distributed locks component specs]({{< ref supported-locks >}}).
- Explore distributed locks via any of the supporting [Dapr SDKs]({{% ref sdks %}}).
- Review the [Distributed Lock API reference documentation]({{% ref distributed_lock_api %}}).
- Browse the supported [distributed locks component specs]({{% ref supported-locks %}}).
{{% /alert %}}

View File

@ -18,7 +18,7 @@ Each lock has a name. The application determines the resources that the named lo
For example, in the competing consumer pattern, multiple instances of an application access a queue. You can decide that you want to lock the queue while the application is running its business logic.
In the diagram below, two instances of the same application, `App1`, use the [Redis lock component]({{< ref redis-lock >}}) to take a lock on a shared resource.
In the diagram below, two instances of the same application, `App1`, use the [Redis lock component]({{% ref redis-lock %}}) to take a lock on a shared resource.
- The first app instance acquires the named lock and gets exclusive access.
- The second app instance is unable to acquire the lock and therefore is not allowed to access the resource until the lock is released, either:
@ -41,11 +41,10 @@ Dapr distributed locks use a lease-based locking mechanism. If an application ac
Watch [this video for an overview of the distributed lock API](https://youtu.be/wLYYOJLt_KQ?t=583):
<div class="embed-responsive embed-responsive-16by9">
<iframe width="360" height="315" src="https://www.youtube-nocookie.com/embed/wLYYOJLt_KQ?start=583" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
{{< youtube id=wLYYOJLt_KQ start=583 >}}
## Next steps
Follow these guides on:
- [How-To: Use distributed locks in your application]({{< ref howto-use-distributed-lock.md >}})
- [How-To: Use distributed locks in your application]({{% ref howto-use-distributed-lock %}})

View File

@ -22,7 +22,7 @@ The diagram below shows two instances of different applications, acquiring diffe
### Configure a lock component
Save the following component file to the [default components folder]({{< ref "install-dapr-selfhost.md#step-5-verify-components-directory-has-been-initialized" >}}) on your machine.
Save the following component file to the [default components folder]({{% ref "install-dapr-selfhost#step-5-verify-components-directory-has-been-initialized" %}}) on your machine.
```yaml
apiVersion: dapr.io/v1alpha1
@ -41,9 +41,9 @@ spec:
### Acquire lock
{{< tabs HTTP ".NET" Go >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "HTTP" %}}
```bash
curl -X POST http://localhost:3500/v1.0-alpha1/lock/lockstore
@ -51,9 +51,9 @@ curl -X POST http://localhost:3500/v1.0-alpha1/lock/lockstore
-d '{"resourceId":"my_file_name", "lockOwner":"random_id_abc123", "expiryInSeconds": 60}'
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using System;
@ -86,9 +86,9 @@ namespace LockService
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
package main
@ -116,15 +116,15 @@ func main() {
}
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
### Unlock existing lock
{{< tabs HTTP ".NET" Go >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "HTTP" %}}
```bash
curl -X POST http://localhost:3500/v1.0-alpha1/unlock/lockstore
@ -132,9 +132,9 @@ curl -X POST http://localhost:3500/v1.0-alpha1/unlock/lockstore
-d '{"resourceId":"my_file_name", "lockOwner":"random_id_abc123"}'
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using System;
@ -156,9 +156,9 @@ namespace LockService
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
package main
@ -185,10 +185,10 @@ func main() {
}
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Next steps
Read [the distributed lock API overview]({{< ref distributed-lock-api-overview.md >}}) to learn more.
Read [the distributed lock API overview]({{% ref distributed-lock-api-overview %}}) to learn more.

View File

@ -6,7 +6,7 @@ weight: 5000
description: "Learn how to use the jobs API to schedule and handle triggered jobs"
---
Now that you've learned what the [jobs building block]({{< ref jobs-overview.md >}}) provides, let's look at an example of how to use the API. The code example below describes an application that schedules jobs for a database backup application and handles them at trigger time, also known as the time the job was sent back to the application because it reached it's dueTime.
Now that you've learned what the [jobs building block]({{% ref jobs-overview %}}) provides, let's look at an example of how to use the API. The code example below describes an application that schedules jobs for a database backup application and handles them at trigger time, also known as the time the job was sent back to the application because it reached it's dueTime.
<!--
Include a diagram or image, if possible.
@ -14,15 +14,15 @@ Include a diagram or image, if possible.
## Start the Scheduler service
When you [run `dapr init` in either self-hosted mode or on Kubernetes]({{< ref install-dapr-selfhost.md >}}), the Dapr Scheduler service is started.
When you [run `dapr init` in either self-hosted mode or on Kubernetes]({{% ref install-dapr-selfhost %}}), the Dapr Scheduler service is started.
## Set up the Jobs API
In your code, set up and schedule jobs within your application.
{{< tabs ".NET" "Go" >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
<!-- .NET -->
@ -116,9 +116,9 @@ await daprJobsClient.ScheduleJobAsync("prod-db-backup", DaprJobSchedule.FromDura
serializedJobData, repeats: 10);
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
<!--go-->
@ -221,17 +221,17 @@ func prodDBBackupHandler(ctx context.Context, job *common.JobEvent) error {
}
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Run the Dapr sidecar
Once you've set up the Jobs API in your application, in a terminal window run the Dapr sidecar with the following command.
{{< tabs "Go" >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Go" %}}
```bash
dapr run --app-id=distributed-scheduler \
@ -243,12 +243,12 @@ dapr run --app-id=distributed-scheduler \
go run ./main.go
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Next steps
- [Learn more about the Scheduler control plane service]({{< ref "concepts/dapr-services/scheduler.md" >}})
- [Jobs API reference]({{< ref jobs_api.md >}})
- [Learn more about the Scheduler control plane service]({{% ref "concepts/dapr-services/scheduler" %}})
- [Jobs API reference]({{% ref jobs_api %}})

View File

@ -6,7 +6,7 @@ weight: 2000
description: "Learn more about the Dapr Jobs features and concepts"
---
Now that you've learned about the [jobs building block]({{< ref jobs-overview.md >}}) at a high level, let's deep dive
Now that you've learned about the [jobs building block]({{% ref jobs-overview %}}) at a high level, let's deep dive
into the features and concepts included with Dapr Jobs and the various SDKs. Dapr Jobs:
- Provides a robust and scalable API for scheduling operations to be triggered in the future.
- Exposes several capabilities which are common across all supported languages.

View File

@ -11,10 +11,10 @@ Many applications require job scheduling, or the need to take an action in the f
Not only does the jobs API help you with scheduling jobs, but internally, Dapr uses the Scheduler service to schedule actor reminders.
Jobs in Dapr consist of:
- [The jobs API building block]({{< ref jobs_api.md >}})
- [The Scheduler control plane service]({{< ref "concepts/dapr-services/scheduler.md" >}})
- [The jobs API building block]({{% ref jobs_api %}})
- [The Scheduler control plane service]({{% ref "concepts/dapr-services/scheduler.md" %}})
[See example scenarios.]({{< ref "#scenarios" >}})
[See example scenarios.]({{% ref "#scenarios" %}})
<img src="/images/scheduler/scheduler-architecture.png" alt="Diagram showing the Scheduler control plane service and the jobs API">
@ -27,8 +27,8 @@ The jobs API is a job scheduler, not the executor which runs the job. The design
All job details and user-associated data for scheduled jobs are stored in an embedded Etcd database in the Scheduler service.
You can use jobs to:
- **Delay your [pub/sub messaging]({{< ref pubsub-overview.md >}}).** You can publish a message in a future specific time (for example: a week from today, or a specific UTC date/time).
- **Schedule [service invocation]({{< ref service-invocation-overview.md >}}) method calls between applications.**
- **Delay your [pub/sub messaging]({{% ref pubsub-overview %}}).** You can publish a message in a future specific time (for example: a week from today, or a specific UTC date/time).
- **Schedule [service invocation]({{% ref service-invocation-overview %}}) method calls between applications.**
## Scenarios
@ -63,10 +63,10 @@ The Scheduler service enables the scheduling of jobs to scale across multiple re
## Try out the jobs API
You can try out the jobs API in your application. After [Dapr is installed]({{< ref install-dapr-cli.md >}}), you can begin using the jobs API, starting with [the How-to: Schedule jobs guide]({{< ref howto-schedule-and-handle-triggered-jobs.md >}}).
You can try out the jobs API in your application. After [Dapr is installed]({{% ref install-dapr-cli %}}), you can begin using the jobs API, starting with [the How-to: Schedule jobs guide]({{% ref howto-schedule-and-handle-triggered-jobs %}}).
## Next steps
- [Learn how to use the jobs API]({{< ref howto-schedule-and-handle-triggered-jobs.md >}})
- [Learn more about the Scheduler control plane service]({{< ref "concepts/dapr-services/scheduler.md" >}})
- [Jobs API reference]({{< ref jobs_api.md >}})
- [Learn how to use the jobs API]({{% ref howto-schedule-and-handle-triggered-jobs %}})
- [Learn more about the Scheduler control plane service]({{% ref "concepts/dapr-services/scheduler" %}})
- [Jobs API reference]({{% ref jobs_api %}})

View File

@ -8,8 +8,8 @@ description: Secure, scalable messaging between services
{{% alert title="More about Dapr Pub/sub" color="primary" %}}
Learn more about how to use Dapr Pub/sub:
- Try the [Pub/sub quickstart]({{< ref pubsub-quickstart.md >}}).
- Explore pub/sub via any of the supporting [Dapr SDKs]({{< ref sdks >}}).
- Review the [Pub/sub API reference documentation]({{< ref pubsub_api.md >}}).
- Browse the supported [pub/sub component specs]({{< ref supported-pubsub >}}).
- Try the [Pub/sub quickstart]({{% ref pubsub-quickstart %}}).
- Explore pub/sub via any of the supporting [Dapr SDKs]({{% ref sdks %}}).
- Review the [Pub/sub API reference documentation]({{% ref pubsub_api %}}).
- Browse the supported [pub/sub component specs]({{% ref supported-pubsub %}}).
{{% /alert %}}

View File

@ -6,7 +6,7 @@ weight: 5000
description: "Learn how to use the metadata-based namespace consumer group in your component"
---
You've set up [Dapr's pub/sub API building block]({{< ref pubsub-overview >}}), and your applications are publishing and subscribing to topics smoothly, using a centralized message broker. What if you'd like to perform simple A/B testing, blue/green deployments, or even canary deployments for your applications? Even with using Dapr, this can prove difficult.
You've set up [Dapr's pub/sub API building block]({{% ref pubsub-overview %}}), and your applications are publishing and subscribing to topics smoothly, using a centralized message broker. What if you'd like to perform simple A/B testing, blue/green deployments, or even canary deployments for your applications? Even with using Dapr, this can prove difficult.
Dapr solves multi-tenancy at-scale with its pub/sub namespace consumer groups construct.
@ -67,8 +67,8 @@ If you add the namespace consumer group to your metadata afterwards, Dapr update
Watch [this video for an overview on pub/sub multi-tenancy](https://youtu.be/eK463jugo0c?t=1188):
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/eK463jugo0c?start=1188" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
{{< youtube id=eK463jugo0c start=1188 >}}
## Next steps
- Learn more about configuring Pub/Sub components with multiple namespaces [pub/sub namespaces]({{< ref pubsub-namespaces >}}).
- Learn more about configuring Pub/Sub components with multiple namespaces [pub/sub namespaces]({{% ref pubsub-namespaces %}}).

View File

@ -14,12 +14,12 @@ Now that you've learned what the Dapr pub/sub building block provides, learn how
<img src="/images/pubsub-howto-overview.png" width=1000 alt="Diagram showing state management of example service">
Dapr automatically wraps the user payload in a CloudEvents v1.0 compliant envelope, using `Content-Type` header value for `datacontenttype` attribute. [Learn more about messages with CloudEvents.]({{< ref pubsub-cloudevents.md >}})
Dapr automatically wraps the user payload in a CloudEvents v1.0 compliant envelope, using `Content-Type` header value for `datacontenttype` attribute. [Learn more about messages with CloudEvents.]({{% ref pubsub-cloudevents %}})
The following example demonstrates how your applications publish and subscribe to a topic called `orders`.
{{% alert title="Note" color="primary" %}}
If you haven't already, [try out the pub/sub quickstart]({{< ref pubsub-quickstart.md >}}) for a quick walk-through on how to use pub/sub.
If you haven't already, [try out the pub/sub quickstart]({{% ref pubsub-quickstart %}}) for a quick walk-through on how to use pub/sub.
{{% /alert %}}
@ -27,9 +27,9 @@ The following example demonstrates how your applications publish and subscribe t
The first step is to set up the pub/sub component:
{{< tabs "Self-Hosted (CLI)" Kubernetes >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Self-Hosted (CLI)" %}}
When you run `dapr init`, Dapr creates a default Redis `pubsub.yaml` and runs a Redis container on your local machine, located:
- On Windows, under `%UserProfile%\.dapr\components\pubsub.yaml`
@ -63,55 +63,13 @@ scopes:
- checkout
```
You can override this file with another [pubsub component]({{< ref setup-pubsub >}}) by creating a components directory (in this example, `myComponents`) containing the file and using the flag `--resources-path` with the `dapr run` CLI command.
You can override this file with another [pubsub component]({{% ref setup-pubsub %}}) by creating a components directory (in this example, `myComponents`) containing the file and using the flag `--resources-path` with the `dapr run` CLI command.
{{< tabs ".NET" Java Python Go JavaScript >}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Kubernetes" %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- dotnet run
```
{{% /codetab %}}
{{% codetab %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- mvn spring-boot:run
```
{{% /codetab %}}
{{% codetab %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- python3 app.py
```
{{% /codetab %}}
{{% codetab %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- go run app.go
```
{{% /codetab %}}
{{% codetab %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- npm start
```
{{% /codetab %}}
{{< /tabs >}}
{{% /codetab %}}
{{% codetab %}}
To deploy this into a Kubernetes cluster, fill in the `metadata` connection details of the [pub/sub component]({{< ref setup-pubsub >}}) in the YAML below, save as `pubsub.yaml`, and run `kubectl apply -f pubsub.yaml`.
To deploy this into a Kubernetes cluster, fill in the `metadata` connection details of the [pub/sub component]({{% ref setup-pubsub %}}) in the YAML below, save as `pubsub.yaml`, and run `kubectl apply -f pubsub.yaml`.
```yaml
apiVersion: dapr.io/v1alpha1
@ -147,9 +105,53 @@ scopes:
- checkout
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabpane >}}
{{< tabpane text=true >}}
{{% tab ".NET" %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- dotnet run
```
{{% /tab %}}
{{% tab "Java" %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- mvn spring-boot:run
```
{{% /tab %}}
{{% tab "Python" %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- python3 app.py
```
{{% /tab %}}
{{% tab "Go" %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- go run app.go
```
{{% /tab %}}
{{% tab "JavaScript" %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- npm start
```
{{% /tab %}}
{{< /tabpane >}}
{{< /tabs >}}
## Subscribe to topics
@ -159,7 +161,7 @@ Dapr provides three methods by which you can subscribe to topics:
- **Streaming**, where subscriptions are defined in user code.
- **Programmatically**, where subscriptions are defined in user code.
Learn more in the [declarative, streaming, and programmatic subscriptions doc]({{< ref subscription-methods.md >}}). This example demonstrates a **declarative** subscription.
Learn more in the [declarative, streaming, and programmatic subscriptions doc]({{% ref subscription-methods %}}). This example demonstrates a **declarative** subscription.
Create a file named `subscription.yaml` and paste the following:
@ -188,15 +190,15 @@ Place `subscription.yaml` in the same directory as your `pubsub.yaml` component.
{{% alert title="Note" color="primary" %}}
This feature is currently in preview.
Dapr can be made to "hot reload" declarative subscriptions, whereby updates are picked up automatically without needing a restart.
This is enabled by via the [`HotReload` feature gate]({{< ref "support-preview-features.md" >}}).
This is enabled by via the [`HotReload` feature gate]({{% ref "support-preview-features" %}}).
To prevent reprocessing or loss of unprocessed messages, in-flight messages between Dapr and your application are unaffected during hot reload events.
{{% /alert %}}
Below are code examples that leverage Dapr SDKs to subscribe to the topic you defined in `subscription.yaml`.
{{< tabs ".NET" Java Python Go JavaScript>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using System.Collections.Generic;
@ -227,9 +229,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id checkout --app-port 6002 --dapr-http-port 3602 --dapr-grpc-port 60002 --app-protocol https dotnet run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
//dependencies
@ -267,9 +269,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id checkout --app-port 6002 --dapr-http-port 3602 --dapr-grpc-port 60002 mvn spring-boot:run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
@ -296,9 +298,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id checkout --app-port 6002 --dapr-http-port 3602 --app-protocol grpc -- python3 CheckoutService.py
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
//dependencies
@ -341,9 +343,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id checkout --app-port 6002 --dapr-http-port 3602 --dapr-grpc-port 60002 go run CheckoutService.go
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
//dependencies
@ -383,9 +385,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id checkout --app-port 6002 --dapr-http-port 3602 --dapr-grpc-port 60002 npm start
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Publish a message
@ -397,39 +399,39 @@ dapr run --app-id orderprocessing --dapr-http-port 3601
Then publish a message to the `orders` topic:
{{< tabs "Dapr CLI" "HTTP API (Bash)" "HTTP API (PowerShell)">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Dapr CLI" %}}
```bash
dapr publish --publish-app-id orderprocessing --pubsub order-pub-sub --topic orders --data '{"orderId": "100"}'
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (Bash)" %}}
```bash
curl -X POST http://localhost:3601/v1.0/publish/order-pub-sub/orders -H "Content-Type: application/json" -d '{"orderId": "100"}'
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
```powershell
Invoke-RestMethod -Method Post -ContentType 'application/json' -Body '{"orderId": "100"}' -Uri 'http://localhost:3601/v1.0/publish/order-pub-sub/orders'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
Below are code examples that leverage Dapr SDKs to publish a topic.
{{< tabs ".NET" Java Python Go JavaScript>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using System;
@ -469,9 +471,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 --app-protocol https dotnet run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
//dependencies
@ -519,9 +521,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 mvn spring-boot:run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
@ -556,9 +558,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --app-protocol grpc python3 OrderProcessingService.py
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
//dependencies
@ -604,9 +606,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 go run OrderProcessingService.go
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
//dependencies
@ -651,9 +653,9 @@ Navigate to the directory containing the above code, then run the following comm
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 npm start
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Message acknowledgement and retries
@ -663,11 +665,11 @@ In order to tell Dapr that a message was processed successfully, return a `200 O
Watch [this demo video](https://youtu.be/1dqe1k-FXJQ?si=s3gvWxRxeOsmXuE1) to learn more about pub/sub messaging with Dapr.
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/1dqe1k-FXJQ?si=s3gvWxRxeOsmXuE1" title="YouTube video player" style="padding-bottom:25px;" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
{{< youtube id=1dqe1k-FXJQ >}}
## Next steps
- Try the [pub/sub tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/pub-sub).
- Learn about [messaging with CloudEvents]({{< ref pubsub-cloudevents.md >}}) and when you might want to [send messages without CloudEvents]({{< ref pubsub-raw.md >}}).
- Review the list of [pub/sub components]({{< ref setup-pubsub >}}).
- Read the [API reference]({{< ref pubsub_api.md >}}).
- Learn about [messaging with CloudEvents]({{% ref pubsub-cloudevents %}}) and when you might want to [send messages without CloudEvents]({{% ref pubsub-raw %}}).
- Review the list of [pub/sub components]({{% ref setup-pubsub %}}).
- Read the [API reference]({{% ref pubsub_api %}}).

View File

@ -10,7 +10,7 @@ Pub/sub routing is an implementation of [content-based routing](https://www.ente
While routing can be implemented with code, keeping routing rules external from the application can improve portability.
This feature is available to both the [declarative and programmatic subscription approaches]({{< ref subscription-methods.md >}}), however does not apply to streaming subscriptions.
This feature is available to both the [declarative and programmatic subscription approaches]({{% ref subscription-methods %}}), however does not apply to streaming subscriptions.
## Declarative subscription
@ -40,9 +40,9 @@ scopes:
In the programmatic approach, the `routes` structure is returned instead of `route`. The JSON structure matches the declarative YAML:
{{< tabs Python JavaScript ".NET" Go PHP>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Python" %}}
```python
import flask
from flask import request, jsonify
@ -82,9 +82,9 @@ def ds_subscriber():
app.run()
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
const express = require('express')
const bodyParser = require('body-parser')
@ -122,9 +122,9 @@ app.post('/products', (req, res) => {
app.listen(port, () => console.log(`consumer app listening on port ${port}!`))
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
[Topic("pubsub", "inventory", "event.type ==\"widget\"", 1)]
[HttpPost("widgets")]
@ -150,9 +150,9 @@ app.listen(port, () => console.log(`consumer app listening on port ${port}!`))
return stock;
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```golang
package main
@ -216,9 +216,9 @@ func main() {
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", appPort), router))
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "PHP" %}}
```php
<?php
@ -243,9 +243,9 @@ $app->post('/products', function(
);
$app->start();
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Common Expression Language (CEL)
@ -255,7 +255,7 @@ In these examples, depending on the `event.type`, the application will be called
- `/gadgets`
- `/products`
The expressions are written as [Common Expression Language (CEL)](https://github.com/google/cel-spec) where `event` represents the cloud event. Any of the attributes from the [CloudEvents core specification](https://github.com/cloudevents/spec/blob/v1.0.1/spec.md#required-attributes) can be referenced in the expression.
The expressions are written as [Common Expression Language (CEL)](https://github.com/google/cel-spec) where `event` represents the cloud event. Any of the attributes from the [CloudEvents core specification](https://github.com/cloudevents/spec/blob/v1.0.1/spec#required-attributes) can be referenced in the expression.
### Example expressions
@ -271,7 +271,7 @@ Match deposits greater than $10,000:
event.type == "deposit" && int(event.data.amount) > 10000
```
{{% alert title="Note" color="primary" %}}
By default the numeric values are written as double-precision floating-point. There are no automatic arithmetic conversions for numeric values. In this case, if `event.data.amount` is not cast as integer, the match is not performed. For more information, see the [CEL documentation](https://github.com/google/cel-spec/blob/master/doc/langdef.md).
By default the numeric values are written as double-precision floating-point. There are no automatic arithmetic conversions for numeric values. In this case, if `event.data.amount` is not cast as integer, the match is not performed. For more information, see the [CEL documentation](https://github.com/google/cel-spec/blob/master/doc/langdef).
{{% /alert %}}
Match multiple versions of a message:
@ -449,14 +449,12 @@ Currently, comparisons to time (e.g. before or after "now") are not supported.
Watch [this video](https://www.youtube.com/watch?v=QqJgRmbH82I&t=1063s) on how to use message routing with pub/sub:
<p class="embed-responsive embed-responsive-16by9">
<iframe width="688" height="430" src="https://www.youtube-nocookie.com/embed/QqJgRmbH82I?start=1063" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</p>
{{< youtube id=QqJgRmbH82I start=1063 >}}
## Next steps
- Try the [pub/sub routing sample](https://github.com/dapr/samples/tree/master/pub-sub-routing).
- Learn about [topic scoping]({{< ref pubsub-scopes.md >}}) and [message time-to-live]({{< ref pubsub-message-ttl.md >}}).
- [Configure pub/sub components with multiple namespaces]({{< ref pubsub-namespaces.md >}}).
- Review the list of [pub/sub components]({{< ref setup-pubsub >}}).
- Read the [API reference]({{< ref pubsub_api.md >}}).
- Learn about [topic scoping]({{% ref pubsub-scopes %}}) and [message time-to-live]({{% ref pubsub-message-ttl %}}).
- [Configure pub/sub components with multiple namespaces]({{% ref pubsub-namespaces %}}).
- Review the list of [pub/sub components]({{% ref setup-pubsub %}}).
- Read the [API reference]({{% ref pubsub_api %}}).

View File

@ -89,6 +89,6 @@ spec:
## Next steps
- Try the [pub/sub tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/pub-sub).
- Learn about [messaging with CloudEvents]({{< ref pubsub-cloudevents.md >}}) and when you might want to [send messages without CloudEvents]({{< ref pubsub-raw.md >}}).
- Review the list of [pub/sub components]({{< ref setup-pubsub >}}).
- Read the [API reference]({{< ref pubsub_api.md >}}).
- Learn about [messaging with CloudEvents]({{% ref pubsub-cloudevents %}}) and when you might want to [send messages without CloudEvents]({{% ref pubsub-raw %}}).
- Review the list of [pub/sub components]({{% ref setup-pubsub %}}).
- Read the [API reference]({{% ref pubsub_api %}}).

View File

@ -22,9 +22,9 @@ The bulk publish operation also does not guarantee any ordering of messages.
### Example
{{< tabs Java JavaScript ".NET" Python Go "HTTP API (Bash)" "HTTP API (PowerShell)" >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Java" %}}
```java
import io.dapr.client.DaprClientBuilder;
@ -54,9 +54,9 @@ class BulkPublisher {
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```typescript
@ -105,9 +105,9 @@ start().catch((e) => {
});
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using System;
@ -143,9 +143,9 @@ else
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
import requests
@ -173,9 +173,9 @@ response = requests.post(base_url.format(pubsub_name, topic_name), json=payload)
print(response.status_code)
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
package main
@ -220,9 +220,9 @@ func main() {
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (Bash)" %}}
```bash
curl -X POST http://localhost:3500/v1.0-alpha1/publish/bulk/my-pubsub-name/topic-a \
@ -243,9 +243,9 @@ curl -X POST http://localhost:3500/v1.0-alpha1/publish/bulk/my-pubsub-name/topic
]'
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
```powershell
Invoke-RestMethod -Method Post -ContentType 'application/json' -Uri 'http://localhost:3500/v1.0-alpha1/publish/bulk/my-pubsub-name/topic-a' `
@ -265,14 +265,14 @@ Invoke-RestMethod -Method Post -ContentType 'application/json' -Uri 'http://loca
]'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Subscribing messages in bulk
The bulk subscribe API allows you to subscribe multiple messages from a topic in a single request.
As we know from [How to: Publish & Subscribe to topics]({{< ref howto-publish-subscribe.md >}}), there are three ways to subscribe to topic(s):
As we know from [How to: Publish & Subscribe to topics]({{% ref howto-publish-subscribe %}}), there are three ways to subscribe to topic(s):
- **Declaratively** - subscriptions are defined in an external file.
- **Programmatically** - subscriptions are defined in code.
@ -302,10 +302,10 @@ scopes:
In the example above, `bulkSubscribe` is _optional_. If you use `bulkSubscribe`, then:
- `enabled` is mandatory and enables or disables bulk subscriptions on this topic
- You can optionally configure the max number of messages (`maxMessagesCount`) delivered in a bulk message.
Default value of `maxMessagesCount` for components not supporting bulk subscribe is 100 i.e. for default bulk events between App and Dapr. Please refer [How components handle publishing and subscribing to bulk messages]({{< ref pubsub-bulk >}}).
Default value of `maxMessagesCount` for components not supporting bulk subscribe is 100 i.e. for default bulk events between App and Dapr. Please refer [How components handle publishing and subscribing to bulk messages]({{% ref pubsub-bulk %}}).
If a component supports bulk subscribe, then default value for this parameter can be found in that component doc.
- You can optionally provide the max duration to wait (`maxAwaitDurationMs`) before a bulk message is sent to the app.
Default value of `maxAwaitDurationMs` for components not supporting bulk subscribe is 1000 i.e. for default bulk events between App and Dapr. Please refer [How components handle publishing and subscribing to bulk messages]({{< ref pubsub-bulk >}}).
Default value of `maxAwaitDurationMs` for components not supporting bulk subscribe is 1000 i.e. for default bulk events between App and Dapr. Please refer [How components handle publishing and subscribing to bulk messages]({{% ref pubsub-bulk %}}).
If a component supports bulk subscribe, then default value for this parameter can be found in that component doc.
The application receives an `EntryId` associated with each entry (individual message) in the bulk message. This `EntryId` must be used by the app to communicate the status of that particular entry. If the app fails to notify on an `EntryId` status, it's considered a `RETRY`.
@ -336,14 +336,14 @@ Status | Description
`RETRY` | Message to be retried by Dapr
`DROP` | Warning is logged and message is dropped
Refer to [Expected HTTP Response for Bulk Subscribe]({{< ref pubsub_api.md >}}) for further insights on response.
Refer to [Expected HTTP Response for Bulk Subscribe]({{% ref pubsub_api %}}) for further insights on response.
### Example
The following code examples demonstrate how to use Bulk Subscribe.
{{< tabs "Java" "JavaScript" ".NET" "Python" >}}
{{% codetab %}}
{{< tabpane text=true >}}
{{% tab "Java" %}}
```java
import io.dapr.Topic;
@ -383,9 +383,9 @@ class BulkSubscriber {
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```typescript
@ -418,9 +418,9 @@ async function start() {
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using Microsoft.AspNetCore.Mvc;
@ -468,9 +468,9 @@ public class BulkMessageController : ControllerBase
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
Currently, you can only bulk subscribe in Python using an HTTP client.
```python
@ -510,9 +510,9 @@ if __name__ == '__main__':
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## How components handle publishing and subscribing to bulk messages
@ -542,13 +542,14 @@ Watch the following demos and presentations about bulk pub/sub.
### [KubeCon Europe 2023 presentation](https://youtu.be/WMBAo-UNg6o)
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/WMBAo-UNg6o" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
{{< youtube id=WMBAo-UNg6o >}}
### [Dapr Community Call #77 presentation](https://youtu.be/BxiKpEmchgQ?t=1170)
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/BxiKpEmchgQ?start=1170" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
{{< youtube id=BxiKpEmchgQ start=1170 >}}
## Related links
- List of [supported pub/sub components]({{< ref supported-pubsub >}})
- Read the [API reference]({{< ref pubsub_api.md >}})
- List of [supported pub/sub components]({{% ref supported-pubsub %}})
- Read the [API reference]({{% ref pubsub_api %}})

View File

@ -6,7 +6,7 @@ weight: 2100
description: "Learn why Dapr uses CloudEvents, how they work in Dapr pub/sub, and how to create CloudEvents."
---
To enable message routing and provide additional context with each message, Dapr uses the [CloudEvents 1.0 specification](https://github.com/cloudevents/spec/tree/v1.0) as its message format. Any message sent by an application to a topic using Dapr is automatically wrapped in a CloudEvents envelope, using the [`Content-Type` header value]({{< ref "pubsub-overview.md#content-types" >}}) for `datacontenttype` attribute.
To enable message routing and provide additional context with each message, Dapr uses the [CloudEvents 1.0 specification](https://github.com/cloudevents/spec/tree/v1.0) as its message format. Any message sent by an application to a topic using Dapr is automatically wrapped in a CloudEvents envelope, using the [`Content-Type` header value]({{% ref "pubsub-overview#content-types" %}}) for `datacontenttype` attribute.
Dapr uses CloudEvents to provide additional context to the event payload, enabling features like:
@ -93,11 +93,11 @@ The ability to replace CloudEvents properties using these metadata properties ap
### Example
For example, to replace the `source` and `id` values from [the CloudEvent example above]({{< ref "#cloudevents-example" >}}) in code:
For example, to replace the `source` and `id` values from [the CloudEvent example above]({{% ref "#cloudevents-example" %}}) in code:
{{< tabs "Python" ".NET" >}}
{{< tabpane text=true >}}
<!-- Python -->
{{% codetab %}}
{{% tab "Python" %}}
```python
with DaprClient() as client:
@ -130,10 +130,10 @@ with DaprClient() as client:
)
```
{{% /codetab %}}
{{% /tab %}}
<!-- .NET -->
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
var order = new Order(i);
@ -152,9 +152,9 @@ Console.WriteLine("Published data: " + order);
await Task.Delay(TimeSpan.FromSeconds(1));
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
The JSON payload then reflects the new `source` and `id` values:
@ -180,14 +180,14 @@ The JSON payload then reflects the new `source` and `id` values:
```
{{% alert title="Important" color="warning" %}}
While you can replace `traceid`/`traceparent` and `tracestate`, doing this may interfere with tracing events and report inconsistent results in tracing tools. It's recommended to use Open Telemetry for distributed traces. [Learn more about distributed tracing.]({{< ref tracing-overview.md >}})
While you can replace `traceid`/`traceparent` and `tracestate`, doing this may interfere with tracing events and report inconsistent results in tracing tools. It's recommended to use Open Telemetry for distributed traces. [Learn more about distributed tracing.]({{% ref tracing-overview %}})
{{% /alert %}}
## Publish your own CloudEvent
If you want to use your own CloudEvent, make sure to specify the [`datacontenttype`]({{< ref "pubsub-overview.md#setting-message-content-types" >}}) as `application/cloudevents+json`.
If you want to use your own CloudEvent, make sure to specify the [`datacontenttype`]({{% ref "pubsub-overview#setting-message-content-types" %}}) as `application/cloudevents+json`.
If the CloudEvent that was authored by the app does not contain the [minimum required fields](https://github.com/cloudevents/spec/blob/v1.0.2/cloudevents/spec.md#required-attributes) in the CloudEvent specification, the message is rejected. Dapr adds the following fields to the CloudEvent if they are missing:
@ -205,9 +205,9 @@ You can add additional fields to a custom CloudEvent that are not part of the of
### Example
{{< tabs "Dapr CLI" "HTTP API (Bash)" "HTTP API (PowerShell)">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Dapr CLI" %}}
Publish a CloudEvent to the `orders` topic:
@ -215,9 +215,9 @@ Publish a CloudEvent to the `orders` topic:
dapr publish --publish-app-id orderprocessing --pubsub order-pub-sub --topic orders --data '{\"orderId\": \"100\"}'
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (Bash)" %}}
Publish a CloudEvent to the `orders` topic:
@ -225,9 +225,9 @@ Publish a CloudEvent to the `orders` topic:
curl -X POST http://localhost:3601/v1.0/publish/order-pub-sub/orders -H "Content-Type: application/cloudevents+json" -d '{"specversion" : "1.0", "type" : "com.dapr.cloudevent.sent", "source" : "testcloudeventspubsub", "subject" : "Cloud Events Test", "id" : "someCloudEventId", "time" : "2021-08-02T09:00:00Z", "datacontenttype" : "application/cloudevents+json", "data" : {"orderId": "100"}}'
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
Publish a CloudEvent to the `orders` topic:
@ -235,9 +235,9 @@ Publish a CloudEvent to the `orders` topic:
Invoke-RestMethod -Method Post -ContentType 'application/cloudevents+json' -Body '{"specversion" : "1.0", "type" : "com.dapr.cloudevent.sent", "source" : "testcloudeventspubsub", "subject" : "Cloud Events Test", "id" : "someCloudEventId", "time" : "2021-08-02T09:00:00Z", "datacontenttype" : "application/cloudevents+json", "data" : {"orderId": "100"}}' -Uri 'http://localhost:3601/v1.0/publish/order-pub-sub/orders'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Event deduplication
@ -245,8 +245,8 @@ When using cloud events created by Dapr, the envelope contains an `id` field whi
## Next steps
- Learn why you might [not want to use CloudEvents]({{< ref pubsub-raw.md >}})
- Try out the [pub/sub Quickstart]({{< ref pubsub-quickstart.md >}})
- List of [pub/sub components]({{< ref setup-pubsub >}})
- Read the [API reference]({{< ref pubsub_api.md >}})
- Learn why you might [not want to use CloudEvents]({{% ref pubsub-raw %}})
- Try out the [pub/sub Quickstart]({{% ref pubsub-quickstart %}})
- List of [pub/sub components]({{% ref setup-pubsub %}})
- Read the [API reference]({{% ref pubsub_api %}})

View File

@ -14,7 +14,7 @@ Dead letter topics are typically used in along with a retry resiliency policy an
When a dead letter topic is set, any message that failed to be delivered to an app for a configured topic is put on the dead letter topic to be forwarded to a subscription that handles these messages. This could be the same app or a completely different one.
Dapr enables dead letter topics for all of it's pub/sub components, even if the underlying system does not support this feature natively. For example the [AWS SNS Component]({{< ref "setup-aws-snssqs" >}}) has a dead letter queue and [RabbitMQ]({{< ref "setup-rabbitmq" >}}) has the dead letter topics. You will need to ensure that you configure components like this appropriately.
Dapr enables dead letter topics for all of it's pub/sub components, even if the underlying system does not support this feature natively. For example the [AWS SNS Component]({{% ref "setup-aws-snssqs" %}}) has a dead letter queue and [RabbitMQ]({{% ref "setup-rabbitmq" %}}) has the dead letter topics. You will need to ensure that you configure components like this appropriately.
The diagram below is an example of how dead letter topics work. First a message is sent from a publisher on an `orders` topic. Dapr receives the message on behalf of a subscriber application, however the orders topic message fails to be delivered to the `/checkout` endpoint on the application, even after retries. As a result of the failure to deliver, the message is forwarded to the `poisonMessages` topic which delivers this to the `/failedMessages` endpoint to be processed, in this case on the same application. The `failedMessages` processing code could drop the message or resend a new message.
@ -70,7 +70,7 @@ app.get('/dapr/subscribe', (_req, res) => {
## Retries and dead letter topics
By default, when a dead letter topic is set, any failing message immediately goes to the dead letter topic. As a result it is recommend to always have a retry policy set when using dead letter topics in a subscription.
To enable the retry of a message before sending it to the dead letter topic, apply a [retry resiliency policy]({{< ref "retries-overview.md" >}}) to the pub/sub component.
To enable the retry of a message before sending it to the dead letter topic, apply a [retry resiliency policy]({{% ref "retries-overview" %}}) to the pub/sub component.
This example shows how to set a constant retry policy named `pubsubRetry`, with 10 maximum delivery attempts applied every 5 seconds for the `pubsub` pub/sub component.
@ -117,10 +117,9 @@ scopes:
Watch [this video for an overview of the dead letter topics](https://youtu.be/wLYYOJLt_KQ?t=69):
<iframe width="360" height="315" src="https://www.youtube-nocookie.com/embed/wLYYOJLt_KQ?start=69" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
{{< youtube id=wLYYOJLt_KQ start=69 >}}
## Next steps
- For more information on resiliency policies, read [Resiliency overview]({{< ref resiliency-overview.md >}}).
- For more information on topic subscriptions, read [Declarative, streaming, and programmatic subscription methods]({{< ref "pubsub-overview.md#message-subscription" >}}).
- For more information on resiliency policies, read [Resiliency overview]({{% ref resiliency-overview %}}).
- For more information on topic subscriptions, read [Declarative, streaming, and programmatic subscription methods]({{% ref "pubsub-overview#message-subscription" %}}).

View File

@ -10,7 +10,7 @@ description: "Use time-to-live in pub/sub messages."
Dapr enables per-message time-to-live (TTL). This means that applications can set time-to-live per message, and subscribers do not receive those messages after expiration.
All Dapr [pub/sub components]({{< ref supported-pubsub >}}) are compatible with message TTL, as Dapr handles the TTL logic within the runtime. Simply set the `ttlInSeconds` metadata when publishing a message.
All Dapr [pub/sub components]({{% ref supported-pubsub %}}) are compatible with message TTL, as Dapr handles the TTL logic within the runtime. Simply set the `ttlInSeconds` metadata when publishing a message.
In some components, such as Kafka, time-to-live can be configured in the topic via `retention.ms` as per [documentation](https://kafka.apache.org/documentation/#topicconfigs_retention.ms). With message TTL in Dapr, applications using Kafka can now set time-to-live per message in addition to per topic.
@ -39,15 +39,15 @@ When non-Dapr subscribers use components such as Azure Service Bus, which native
Message TTL can be set in the metadata as part of the publishing request:
{{< tabs curl "Python SDK" "PHP SDK">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "curl" %}}
```bash
curl -X "POST" http://localhost:3500/v1.0/publish/pubsub/TOPIC_A?metadata.ttlInSeconds=120 -H "Content-Type: application/json" -d '{"order-number": "345"}'
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python SDK" %}}
```python
from dapr.clients import DaprClient
@ -65,9 +65,9 @@ with DaprClient() as d:
# Print the request
print(req_data, flush=True)
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "PHP SDK" %}}
```php
<?php
@ -81,15 +81,15 @@ $app->run(function(\DI\FactoryInterface $factory) {
});
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
See [this guide]({{< ref pubsub_api.md >}}) for a reference on the pub/sub API.
See [this guide]({{% ref pubsub_api %}}) for a reference on the pub/sub API.
## Next steps
- Learn about [topic scoping]({{< ref pubsub-scopes.md >}})
- Learn [how to configure pub/sub components with multiple namespaces]({{< ref pubsub-namespaces.md >}})
- List of [pub/sub components]({{< ref supported-pubsub >}})
- Read the [API reference]({{< ref pubsub_api.md >}})
- Learn about [topic scoping]({{% ref pubsub-scopes %}})
- Learn [how to configure pub/sub components with multiple namespaces]({{% ref pubsub-namespaces %}})
- List of [pub/sub components]({{% ref supported-pubsub %}})
- Read the [API reference]({{% ref pubsub_api %}})

View File

@ -34,7 +34,7 @@ When using pub/sub in Dapr:
[The following overview video and demo](https://www.youtube.com/live/0y7ne6teHT4?si=FMg2Y7bRuljKism-&t=5384) demonstrates how Dapr pub/sub works.
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/0y7ne6teHT4?si=FMg2Y7bRuljKism-&amp;start=5384" title="YouTube video player" style="padding-bottom:25px;" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
{{< youtube id=0y7ne6teHT4 start=5384 >}}
In the diagram below, a "shipping" service and an "email" service have both subscribed to topics published by a "cart" service. Each service loads pub/sub component configuration files that point to the same pub/sub message broker component; for example: Redis Streams, NATS Streaming, Azure Service Bus, or GCP pub/sub.
@ -44,7 +44,7 @@ In the diagram below, the Dapr API posts an "order" topic from the publishing "c
<img src="/images/pubsub-overview-publish-API.png" width=1000 style="padding-bottom:25px;">
[View the complete list of pub/sub components that Dapr supports]({{< ref supported-pubsub >}}).
[View the complete list of pub/sub components that Dapr supports]({{% ref supported-pubsub %}}).
## Features
@ -52,15 +52,15 @@ The pub/sub API building block brings several features to your application.
### Sending messages using Cloud Events
To enable message routing and provide additional context with each message between services, Dapr uses the [CloudEvents 1.0 specification](https://github.com/cloudevents/spec/tree/v1.0) as its message format. Any message sent by an application to a topic using Dapr is automatically wrapped in a Cloud Events envelope, using [`Content-Type` header value]({{< ref "pubsub-overview.md#content-types" >}}) for `datacontenttype` attribute.
To enable message routing and provide additional context with each message between services, Dapr uses the [CloudEvents 1.0 specification](https://github.com/cloudevents/spec/tree/v1.0) as its message format. Any message sent by an application to a topic using Dapr is automatically wrapped in a Cloud Events envelope, using [`Content-Type` header value]({{% ref "pubsub-overview#content-types" %}}) for `datacontenttype` attribute.
For more information, read about [messaging with CloudEvents]({{< ref pubsub-cloudevents.md >}}), or [sending raw messages without CloudEvents]({{< ref pubsub-raw.md >}}).
For more information, read about [messaging with CloudEvents]({{% ref pubsub-cloudevents %}}), or [sending raw messages without CloudEvents]({{% ref pubsub-raw %}}).
### Communication with applications not using Dapr and CloudEvents
If one of your applications uses Dapr while another doesn't, you can disable the CloudEvent wrapping for a publisher or subscriber. This allows partial adoption of Dapr pub/sub in applications that cannot adopt Dapr all at once.
For more information, read [how to use pub/sub without CloudEvents]({{< ref pubsub-raw.md >}}).
For more information, read [how to use pub/sub without CloudEvents]({{% ref pubsub-raw %}}).
### Setting message content types
@ -83,34 +83,34 @@ Dapr applications can subscribe to published topics via three subscription types
| **Streaming** | The subscription is defined in the **user code**. Streaming subscriptions are dynamic, meaning they allow for adding or removing subscriptions at runtime. They do not require a subscription endpoint in your application (that is required by both programmatic and declarative subscriptions), making them easy to configure in code. Streaming subscriptions also do not require an app to be configured with the sidecar to receive messages. With streaming subscriptions, since messages are sent to a message handler code, there is no concept of routes or bulk subscriptions. |
| **Programmatic** | Subscription is defined in the **user code**. The programmatic approach implements the static subscription and requires an endpoint in your code. |
For more information, read [about the subscriptions in Subscription Types]({{< ref subscription-methods.md >}}).
For more information, read [about the subscriptions in Subscription Types]({{% ref subscription-methods %}}).
### Reloading topic subscriptions
To reload topic subscriptions that are defined programmatically or declaratively, the Dapr sidecar needs to be restarted.
The Dapr sidecar can be made to dynamically reload changed declarative topic subscriptions without restarting by enabling the [`HotReload` feature gate]({{< ref "support-preview-features.md" >}}).
The Dapr sidecar can be made to dynamically reload changed declarative topic subscriptions without restarting by enabling the [`HotReload` feature gate]({{% ref "support-preview-features" %}}).
Hot reloading of topic subscriptions is currently a preview feature.
In-flight messages are unaffected when reloading a subscription.
### Message routing
Dapr provides [content-based routing](https://www.enterpriseintegrationpatterns.com/ContentBasedRouter.html) pattern. [Pub/sub routing]({{< ref howto-route-messages.md >}}) is an implementation of this pattern that allows developers to use expressions to route [CloudEvents](https://cloudevents.io) based on their contents to different URIs/paths and event handlers in your application. If no route matches, an optional default route is used. This is useful as your applications expands to support multiple event versions or special cases.
Dapr provides [content-based routing](https://www.enterpriseintegrationpatterns.com/ContentBasedRouter.html) pattern. [Pub/sub routing]({{% ref howto-route-messages %}}) is an implementation of this pattern that allows developers to use expressions to route [CloudEvents](https://cloudevents.io) based on their contents to different URIs/paths and event handlers in your application. If no route matches, an optional default route is used. This is useful as your applications expands to support multiple event versions or special cases.
This feature is available to both the declarative and programmatic subscription approaches.
For more information on message routing, read [Dapr pub/sub API reference]({{< ref "pubsub_api.md#provide-routes-for-dapr-to-deliver-topic-events" >}})
For more information on message routing, read [Dapr pub/sub API reference]({{% ref "pubsub_api#provide-routes-for-dapr-to-deliver-topic-events" %}})
### Handling failed messages with dead letter topics
Sometimes, messages can't be processed because of a variety of possible issues, such as erroneous conditions within the producer or consumer application or an unexpected state change that causes an issue with your application code. Dapr allows developers to set dead letter topics to deal with messages that cannot be delivered to an application. This feature is available on all pub/sub components and prevents consumer applications from endlessly retrying a failed message. For more information, read about [dead letter topics]({{< ref "pubsub-deadletter.md">}})
Sometimes, messages can't be processed because of a variety of possible issues, such as erroneous conditions within the producer or consumer application or an unexpected state change that causes an issue with your application code. Dapr allows developers to set dead letter topics to deal with messages that cannot be delivered to an application. This feature is available on all pub/sub components and prevents consumer applications from endlessly retrying a failed message. For more information, read about [dead letter topics]({{% ref "pubsub-deadletter"%}})
### Enabling the outbox pattern
Dapr enables developers to use the outbox pattern for achieving a single transaction across a transactional state store and any message broker. For more information, read [How to enable transactional outbox messaging]({{< ref howto-outbox.md >}})
Dapr enables developers to use the outbox pattern for achieving a single transaction across a transactional state store and any message broker. For more information, read [How to enable transactional outbox messaging]({{% ref howto-outbox %}})
### Namespace consumer groups
Dapr solves multi-tenancy at-scale with [namespaces for consumer groups]({{< ref howto-namespace >}}). Simply include the `"{namespace}"` value in your component metadata for consumer groups to allow multiple namespaces with applications of the same `app-id` to publish and subscribe to the same message broker.
Dapr solves multi-tenancy at-scale with [namespaces for consumer groups]({{% ref howto-namespace %}}). Simply include the `"{namespace}"` value in your component metadata for consumer groups to allow multiple namespaces with applications of the same `app-id` to publish and subscribe to the same message broker.
### At-least-once guarantee
@ -133,26 +133,26 @@ Similarly, if two different applications (with different `app-id`) subscribe to
Not all Dapr pub/sub components support the competing consumer pattern. Currently, the following (non-exhaustive) pub/sub components support this:
- [Apache Kafka]({{< ref setup-apache-kafka >}})
- [Azure Service Bus Queues]({{< ref setup-azure-servicebus-queues >}})
- [RabbitMQ]({{< ref setup-rabbitmq >}})
- [Redis Streams]({{< ref setup-redis-pubsub >}})
- [Apache Kafka]({{% ref setup-apache-kafka %}})
- [Azure Service Bus Queues]({{% ref setup-azure-servicebus-queues %}})
- [RabbitMQ]({{% ref setup-rabbitmq %}})
- [Redis Streams]({{% ref setup-redis-pubsub %}})
### Scoping topics for added security
By default, all topic messages associated with an instance of a pub/sub component are available to every application configured with that component. You can limit which application can publish or subscribe to topics with Dapr topic scoping. For more information, read: [pub/sub topic scoping]({{< ref pubsub-scopes.md >}}).
By default, all topic messages associated with an instance of a pub/sub component are available to every application configured with that component. You can limit which application can publish or subscribe to topics with Dapr topic scoping. For more information, read: [pub/sub topic scoping]({{% ref pubsub-scopes %}}).
### Message Time-to-Live (TTL)
Dapr can set a timeout message on a per-message basis, meaning that if the message is not read from the pub/sub component, then the message is discarded. This timeout message prevents a build up of unread messages. If a message has been in the queue longer than the configured TTL, it is marked as dead. For more information, read [pub/sub message TTL]({{< ref pubsub-message-ttl.md >}}).
Dapr can set a timeout message on a per-message basis, meaning that if the message is not read from the pub/sub component, then the message is discarded. This timeout message prevents a build up of unread messages. If a message has been in the queue longer than the configured TTL, it is marked as dead. For more information, read [pub/sub message TTL]({{% ref pubsub-message-ttl %}}).
### Publish and subscribe to bulk messages
Dapr supports sending and receiving multiple messages in a single request. When writing applications that need to send or receive a large number of messages, using bulk operations allows achieving high throughput by reducing the overall number of requests. For more information, read [pub/sub bulk messages]({{< ref pubsub-bulk.md >}}).
Dapr supports sending and receiving multiple messages in a single request. When writing applications that need to send or receive a large number of messages, using bulk operations allows achieving high throughput by reducing the overall number of requests. For more information, read [pub/sub bulk messages]({{% ref pubsub-bulk %}}).
### Scaling subscribers with StatefulSets
When running on Kubernetes, subscribers can have a sticky `consumerID` per instance when using StatefulSets in combination with the `{podName}` marker. See [how to horizontally scale subscribers with StatefulSets]({{< ref "howto-subscribe-statefulset.md" >}}).
When running on Kubernetes, subscribers can have a sticky `consumerID` per instance when using StatefulSets in combination with the `{podName}` marker. See [how to horizontally scale subscribers with StatefulSets]({{% ref "howto-subscribe-statefulset" %}}).
## Try out pub/sub
@ -162,17 +162,17 @@ Want to put the Dapr pub/sub API to the test? Walk through the following quickst
| Quickstart/tutorial | Description |
| ------------------- | ----------- |
| [Pub/sub quickstart]({{< ref pubsub-quickstart.md >}}) | Send and receive messages using the publish and subscribe API. |
| [Pub/sub quickstart]({{% ref pubsub-quickstart %}}) | Send and receive messages using the publish and subscribe API. |
| [Pub/sub tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/pub-sub) | Demonstrates how to use Dapr to enable pub-sub applications. Uses Redis as a pub-sub component. |
### Start using pub/sub directly in your app
Want to skip the quickstarts? Not a problem. You can try out the pub/sub building block directly in your application to publish messages and subscribe to a topic. After [Dapr is installed]({{< ref "getting-started/_index.md" >}}), you can begin using the pub/sub API starting with [the pub/sub how-to guide]({{< ref howto-publish-subscribe.md >}}).
Want to skip the quickstarts? Not a problem. You can try out the pub/sub building block directly in your application to publish messages and subscribe to a topic. After [Dapr is installed]({{% ref "getting-started/_index" %}}), you can begin using the pub/sub API starting with [the pub/sub how-to guide]({{% ref howto-publish-subscribe %}}).
## Next steps
- Learn about [messaging with CloudEvents]({{< ref pubsub-cloudevents.md >}}) and when you might want to [send messages without CloudEvents]({{< ref pubsub-raw.md >}}).
- Follow [How-To: Configure pub/sub components with multiple namespaces]({{< ref pubsub-namespaces.md >}}).
- Review the list of [pub/sub components]({{< ref setup-pubsub >}}).
- Read the [API reference]({{< ref pubsub_api.md >}}).
- Learn about [messaging with CloudEvents]({{% ref pubsub-cloudevents %}}) and when you might want to [send messages without CloudEvents]({{% ref pubsub-raw %}}).
- Follow [How-To: Configure pub/sub components with multiple namespaces]({{% ref pubsub-namespaces %}}).
- Review the list of [pub/sub components]({{% ref setup-pubsub %}}).
- Read the [API reference]({{% ref pubsub_api %}}).

View File

@ -6,7 +6,7 @@ weight: 2200
description: "Learn when you might not use CloudEvents and how to disable them."
---
When adding Dapr to your application, some services may still need to communicate via pub/sub messages not encapsulated in CloudEvents, due to either compatibility reasons or some apps not using Dapr. These are referred to as "raw" pub/sub messages. Dapr enables apps to [publish and subscribe to raw events]({{< ref "pubsub-cloudevents.md#publishing-raw-messages" >}}) not wrapped in a CloudEvent for compatibility and to send data that is not JSON serializable.
When adding Dapr to your application, some services may still need to communicate via pub/sub messages not encapsulated in CloudEvents, due to either compatibility reasons or some apps not using Dapr. These are referred to as "raw" pub/sub messages. Dapr enables apps to [publish and subscribe to raw events]({{% ref "pubsub-cloudevents#publishing-raw-messages" %}}) not wrapped in a CloudEvent for compatibility and to send data that is not JSON serializable.
## Publishing raw messages
@ -20,15 +20,15 @@ Not using CloudEvents disables support for tracing, event deduplication per mess
To disable CloudEvent wrapping, set the `rawPayload` metadata to `true` as part of the publishing request. This allows subscribers to receive these messages without having to parse the CloudEvent schema.
{{< tabs curl ".NET" "Python" "PHP">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "curl" %}}
```bash
curl -X "POST" http://localhost:3500/v1.0/publish/pubsub/TOPIC_A?metadata.rawPayload=true -H "Content-Type: application/json" -d '{"order-number": "345"}'
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using Dapr.Client;
@ -63,9 +63,9 @@ app.MapPost("/publish", async (DaprClient daprClient) =>
app.Run();
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
from dapr.clients import DaprClient
@ -83,9 +83,9 @@ with DaprClient() as d:
# Print the request
print(req_data, flush=True)
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "PHP" %}}
```php
<?php
@ -99,9 +99,9 @@ $app->run(function(\DI\FactoryInterface $factory) {
});
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Subscribing to raw messages
@ -115,9 +115,9 @@ When subscribing programmatically, add the additional metadata entry for `rawPay
When using raw payloads the message is always base64 encoded with content type `application/octet-stream`.
{{< tabs ".NET" "Python" "PHP" >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using System.Text.Json;
@ -158,9 +158,9 @@ app.MapPost("/messages", async (HttpContext context) =>
app.Run();
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
import flask
@ -190,8 +190,8 @@ def ds_subscriber():
app.run()
```
{{% /codetab %}}
{{% codetab %}}
{{% /tab %}}
{{% tab "PHP" %}}
```php
<?php
@ -214,9 +214,9 @@ $app->post('/dsstatus', function(
$app->start();
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Declaratively subscribe to raw events
@ -241,7 +241,7 @@ scopes:
## Next steps
- Learn more about [publishing and subscribing messages]({{< ref pubsub-overview.md >}})
- List of [pub/sub components]({{< ref supported-pubsub >}})
- Read the [API reference]({{< ref pubsub_api.md >}})
- Learn more about [publishing and subscribing messages]({{% ref pubsub-overview %}})
- List of [pub/sub components]({{% ref supported-pubsub %}})
- Read the [API reference]({{% ref pubsub_api %}})
- Read the .NET sample on how to [consume Kafka messages without CloudEvents](https://github.com/dapr/samples/pubsub-raw-payload)

View File

@ -8,7 +8,7 @@ description: "Use scopes to limit pub/sub topics to specific applications"
## Introduction
[Namespaces or component scopes]({{< ref component-scopes.md >}}) can be used to limit component access to particular applications. These application scopes added to a component limit only the applications with specific IDs to be able to use the component.
[Namespaces or component scopes]({{% ref component-scopes %}}) can be used to limit component access to particular applications. These application scopes added to a component limit only the applications with specific IDs to be able to use the component.
In addition to this general component scope, the following can be limited for pub/sub components:
- Which topics can be used (published or subscribed)
@ -202,13 +202,11 @@ The table below shows which application is allowed to subscribe to the topics:
## Demo
<div class="embed-responsive embed-responsive-16by9">
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/7VdWBBGcbHQ?start=513" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{< youtube id=7VdWBBGcbHQ start=513 >}}
## Next steps
- Learn [how to configure pub/sub components with multiple namespaces]({{< ref pubsub-namespaces.md >}})
- Learn about [message time-to-live]({{< ref pubsub-message-ttl.md >}})
- List of [pub/sub components]({{< ref supported-pubsub >}})
- Read the [API reference]({{< ref pubsub_api.md >}})
- Learn [how to configure pub/sub components with multiple namespaces]({{% ref pubsub-namespaces %}})
- Learn about [message time-to-live]({{% ref pubsub-message-ttl %}})
- List of [pub/sub components]({{% ref supported-pubsub %}})
- Read the [API reference]({{% ref pubsub_api %}})

View File

@ -12,9 +12,9 @@ Dapr applications can subscribe to published topics via three subscription types
| Subscription type | Description |
| ------------------- | ----------- |
| [**Declarative**]({{< ref "subscription-methods.md#declarative-subscriptions" >}}) | Subscription is defined in an **external file**. The declarative approach removes the Dapr dependency from your code and allows for existing applications to subscribe to topics, without having to change code. |
| [**Streaming**]({{< ref "subscription-methods.md#streaming-subscriptions" >}}) | Subscription is defined in the **application code**. Streaming subscriptions are dynamic, meaning they allow for adding or removing subscriptions at runtime. They do not require a subscription endpoint in your application (that is required by both programmatic and declarative subscriptions), making them easy to configure in code. Streaming subscriptions also do not require an app to be configured with the sidecar to receive messages. |
| [**Programmatic**]({{< ref "subscription-methods.md#programmatic-subscriptions" >}}) | Subscription is defined in the **application code**. The programmatic approach implements the static subscription and requires an endpoint in your code. |
| [**Declarative**]({{% ref "subscription-methods#declarative-subscriptions" %}}) | Subscription is defined in an **external file**. The declarative approach removes the Dapr dependency from your code and allows for existing applications to subscribe to topics, without having to change code. |
| [**Streaming**]({{% ref "subscription-methods#streaming-subscriptions" %}}) | Subscription is defined in the **application code**. Streaming subscriptions are dynamic, meaning they allow for adding or removing subscriptions at runtime. They do not require a subscription endpoint in your application (that is required by both programmatic and declarative subscriptions), making them easy to configure in code. Streaming subscriptions also do not require an app to be configured with the sidecar to receive messages. |
| [**Programmatic**]({{% ref "subscription-methods#programmatic-subscriptions" %}}) | Subscription is defined in the **application code**. The programmatic approach implements the static subscription and requires an endpoint in your code. |
The examples below demonstrate pub/sub messaging between a `checkout` app and an `orderprocessing` app via the `orders` topic. The examples demonstrate the same Dapr pub/sub component used first declaratively, then programmatically.
@ -23,7 +23,7 @@ The examples below demonstrate pub/sub messaging between a `checkout` app and an
{{% alert title="Note" color="primary" %}}
This feature is currently in preview.
Dapr can be made to "hot reload" declarative subscriptions, whereby updates are picked up automatically without needing a restart.
This is enabled by via the [`HotReload` feature gate]({{< ref "support-preview-features.md" >}}).
This is enabled by via the [`HotReload` feature gate]({{% ref "support-preview-features" %}}).
To prevent reprocessing or loss of unprocessed messages, in-flight messages between Dapr and your application are unaffected during hot reload events.
{{% /alert %}}
@ -50,49 +50,49 @@ Here the subscription called `order`:
When running Dapr, set the YAML component file path to point Dapr to the component.
{{< tabs ".NET" Java Python JavaScript Go Kubernetes>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- dotnet run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- mvn spring-boot:run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- python3 app.py
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- npm start
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```bash
dapr run --app-id myapp --resources-path ./myComponents -- go run app.go
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Kubernetes" %}}
In Kubernetes, apply the component to the cluster:
@ -100,15 +100,15 @@ In Kubernetes, apply the component to the cluster:
kubectl apply -f subscription.yaml
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
In your application code, subscribe to the topic specified in the Dapr pub/sub component.
{{< tabs ".NET" Java Python JavaScript Go >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
//Subscribe to a topic
@ -119,9 +119,9 @@ public void getCheckout([FromBody] int orderId)
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
import io.dapr.client.domain.CloudEvent;
@ -137,9 +137,9 @@ public Mono<Void> getCheckout(@RequestBody(required = false) CloudEvent<String>
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
from cloudevents.sdk.event import v1
@ -151,9 +151,9 @@ def checkout(event: v1.Event) -> None:
logging.info('Subscriber received: ' + str(data))
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
const express = require('express')
@ -168,9 +168,9 @@ app.post('/orders', (req, res) => {
});
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
//Subscribe to a topic
@ -186,9 +186,9 @@ func eventHandler(ctx context.Context, e *common.TopicEvent) (retry bool, err er
}
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
The `/orders` endpoint matches the `route` defined in the subscriptions and this is where Dapr sends all topic messages to.
@ -203,9 +203,9 @@ As messages are sent to the given message handler code, there is no concept of r
The example below shows the different ways to stream subscribe to a topic.
{{< tabs ".NET" Python Go >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
You can use the `SubscribeAsync` method on the `DaprPublishSubscribeClient` to configure the message handler to use to pull messages from the stream.
@ -248,12 +248,12 @@ Task<TopicResponseAction> HandleMessageAsync(TopicMessage message, CancellationT
}
```
[Learn more about streaming subscriptions using the .NET SDK client.]({{< ref "dotnet-messaging-pubsub-howto.md" >}})
[Learn more about streaming subscriptions using the .NET SDK client.]({{% ref "dotnet-messaging-pubsub-howto" %}})
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
You can use the `subscribe` method, which returns a `Subscription` object and allows you to pull messages from the stream by calling the `next_message` method. This runs in and may block the main thread while waiting for messages.
@ -354,11 +354,11 @@ if __name__ == '__main__':
main()
```
[Learn more about streaming subscriptions using the Python SDK client.]({{< ref "python-client.md#streaming-message-subscription" >}})
[Learn more about streaming subscriptions using the Python SDK client.]({{% ref "python-client#streaming-message-subscription" %}})
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
package main
@ -453,15 +453,15 @@ func eventHandler(e *common.TopicEvent) common.SubscriptionResponseStatus {
}
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Demo
Watch [this video for an overview on streaming subscriptions](https://youtu.be/57l-QDwgI-Y?t=841):
<iframe width="560" height="315" src="https://www.youtube.com/embed/57l-QDwgI-Y?si=EJj3uo306vBUvl3Y&amp;start=841" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe>
{{< youtube id=57l-QDwgI-Y start=841 >}}
### Programmatic subscriptions
@ -471,9 +471,9 @@ The dynamic programmatic approach returns the `routes` JSON structure within the
In the example below, you define the values found in the [declarative YAML subscription](#declarative-subscriptions) above within the application code.
{{< tabs ".NET" Java Python JavaScript Go>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
[Topic("pubsub", "orders")]
@ -504,9 +504,9 @@ app.UseEndpoints(endpoints =>
});
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
@ -525,9 +525,9 @@ public Mono<Void> handleMessage(@RequestBody(required = false) CloudEvent<String
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
@app.route('/dapr/subscribe', methods=['GET'])
@ -555,9 +555,9 @@ def ds_subscriber():
app.run()
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
const express = require('express')
@ -593,9 +593,9 @@ app.post('/orders', (req, res) => {
app.listen(port, () => console.log(`consumer app listening on port ${port}!`))
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
package main
@ -656,17 +656,17 @@ func main() {
log.Fatal(http.ListenAndServe(fmt.Sprintf(":%d", appPort), router))
}
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Next Steps
* Try out the [pub/sub Quickstart]({{< ref pubsub-quickstart.md >}})
* Follow: [How-To: Configure pub/sub components with multiple namespaces]({{< ref pubsub-namespaces.md >}})
* Learn more about [declarative and programmatic subscription methods]({{< ref subscription-methods >}}).
* Learn about [topic scoping]({{< ref pubsub-scopes.md >}})
* Learn about [message TTL]({{< ref pubsub-message-ttl.md >}})
* Learn more about [pub/sub with and without CloudEvent]({{< ref pubsub-cloudevents.md >}})
* List of [pub/sub components]({{< ref supported-pubsub.md >}})
* Read the [pub/sub API reference]({{< ref pubsub_api.md >}})
* Try out the [pub/sub Quickstart]({{% ref pubsub-quickstart %}})
* Follow: [How-To: Configure pub/sub components with multiple namespaces]({{% ref pubsub-namespaces %}})
* Learn more about [declarative and programmatic subscription methods]({{% ref subscription-methods %}}).
* Learn about [topic scoping]({{% ref pubsub-scopes %}})
* Learn about [message TTL]({{% ref pubsub-message-ttl %}})
* Learn more about [pub/sub with and without CloudEvent]({{% ref pubsub-cloudevents %}})
* List of [pub/sub components]({{% ref supported-pubsub %}})
* Read the [pub/sub API reference]({{% ref pubsub_api %}})

View File

@ -8,8 +8,8 @@ description: Securely access secrets from your application
{{% alert title="More about Dapr Secrets" color="primary" %}}
Learn more about how to use Dapr Secrets:
- Try the [Secrets quickstart]({{< ref secrets-quickstart.md >}}).
- Explore secrets via any of the supporting [Dapr SDKs]({{< ref sdks >}}).
- Review the [Secrets API reference documentation]({{< ref secrets_api.md >}}).
- Browse the supported [secrets component specs]({{< ref supported-secret-stores >}}).
- Try the [Secrets quickstart]({{% ref secrets-quickstart %}}).
- Explore secrets via any of the supporting [Dapr SDKs]({{% ref sdks %}}).
- Review the [Secrets API reference documentation]({{% ref secrets_api %}}).
- Browse the supported [secrets component specs]({{% ref supported-secret-stores %}}).
{{% /alert %}}

View File

@ -6,12 +6,12 @@ weight: 2000
description: "Use the secret store building block to securely retrieve a secret"
---
Now that you've learned [what the Dapr secrets building block provides]({{< ref secrets-overview >}}), learn how it can work in your service. This guide demonstrates how to call the secrets API and retrieve secrets in your application code from a configured secret store.
Now that you've learned [what the Dapr secrets building block provides]({{% ref secrets-overview %}}), learn how it can work in your service. This guide demonstrates how to call the secrets API and retrieve secrets in your application code from a configured secret store.
<img src="/images/howto-secrets/secrets-mgmt-overview.png" width=1000 alt="Diagram showing secrets management of example service.">
{{% alert title="Note" color="primary" %}}
If you haven't already, [try out the secrets management quickstart]({{< ref secrets-quickstart.md >}}) for a quick walk-through on how to use the secrets API.
If you haven't already, [try out the secrets management quickstart]({{% ref secrets-quickstart %}}) for a quick walk-through on how to use the secrets API.
{{% /alert %}}
@ -20,7 +20,7 @@ Now that you've learned [what the Dapr secrets building block provides]({{< ref
Before retrieving secrets in your application's code, you must configure a secret store component. This example configures a secret store that uses a local JSON file to store secrets.
{{% alert title="Warning" color="warning" %}}
In a production-grade application, local secret stores are not recommended. [Find alternatives]({{< ref supported-secret-stores >}}) to securely manage your secrets.
In a production-grade application, local secret stores are not recommended. [Find alternatives]({{% ref supported-secret-stores %}}) to securely manage your secrets.
{{% /alert %}}
In your project directory, create a file named `secrets.json` with the following contents:
@ -54,8 +54,8 @@ The path to the secret store JSON is relative to where you call `dapr run`.
For more information:
- See how to [configure a different kind of secret store]({{< ref setup-secret-store >}}).
- Review [supported secret stores]({{< ref supported-secret-stores >}}) to see specific details required for different secret store solutions.
- See how to [configure a different kind of secret store]({{% ref setup-secret-store %}}).
- Review [supported secret stores]({{% ref supported-secret-stores %}}) to see specific details required for different secret store solutions.
## Get a secret
@ -65,15 +65,15 @@ Get the secret by calling the Dapr sidecar using the secrets API:
curl http://localhost:3601/v1.0/secrets/localsecretstore/secret
```
See a [full API reference]({{< ref secrets_api.md >}}).
See a [full API reference]({{% ref secrets_api %}}).
## Calling the secrets API from your code
Now that you've set up the local secret store, call Dapr to get the secrets from your application code. Below are code examples that leverage Dapr SDKs for retrieving a secret.
{{< tabs ".NET" Java Python Go JavaScript>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using System;
@ -97,9 +97,9 @@ var secret = await daprClient.GetSecretAsync(SECRET_STORE_NAME, "secret");
Console.WriteLine($"Result: {string.Join(", ", secret)}");
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
//dependencies
@ -131,9 +131,9 @@ public class OrderProcessingServiceApplication {
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
@ -161,9 +161,9 @@ with DaprClient() as client:
logging.info(sorted(secret.secrets.items()))
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
//dependencies
@ -199,9 +199,9 @@ func main() {
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
//dependencies
@ -228,13 +228,13 @@ async function main() {
main();
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Related links
- Review the [Dapr secrets API features]({{< ref secrets-overview >}}).
- Learn how to [use secrets scopes]({{< ref secrets-scopes >}})
- Read the [secrets API reference]({{< ref secrets_api >}}) and review the [supported secrets]({{< ref supported-secret-stores >}}).
- Learn how to [set up different secret store components]({{< ref setup-secret-store >}}) and how to [reference secrets in your component]({{< ref component-secrets >}}).
- Review the [Dapr secrets API features]({{% ref secrets-overview %}}).
- Learn how to [use secrets scopes]({{% ref secrets-scopes %}})
- Read the [secrets API reference]({{% ref secrets_api %}}) and review the [supported secrets]({{% ref supported-secret-stores %}}).
- Learn how to [set up different secret store components]({{% ref setup-secret-store %}}) and how to [reference secrets in your component]({{% ref component-secrets %}}).

View File

@ -6,7 +6,7 @@ weight: 1000
description: "Overview of secrets management API building block"
---
Applications usually store sensitive information in secrets by using a dedicated secret store. For example, you authenticate databases, services, and external systems with connection strings, keys, tokens, and other application-level secrets stored in a secret store, such as [AWS Secrets Manager, Azure Key Vault, Hashicorp Vault, etc]({{< ref supported-secret-stores >}}).
Applications usually store sensitive information in secrets by using a dedicated secret store. For example, you authenticate databases, services, and external systems with connection strings, keys, tokens, and other application-level secrets stored in a secret store, such as [AWS Secrets Manager, Azure Key Vault, Hashicorp Vault, etc]({{% ref supported-secret-stores %}}).
To access these secret stores, the application imports the secret store SDK, often requiring a fair amount of unrelated boilerplate code. This poses an even greater challenge in multi-cloud scenarios, where different vendor-specific secret stores may be used.
@ -20,7 +20,7 @@ Dapr's dedicated secrets building block API makes it easier for developers to co
[The following overview video and demo](https://www.youtube.com/live/0y7ne6teHT4?si=3bmNSSyIEIVSF-Ej&t=9931) demonstrates how Dapr secrets management works.
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/0y7ne6teHT4?si=3bmNSSyIEIVSF-Ej&amp;start=9931" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
{{< youtube id=0y7ne6teHT4 start=9931 >}}
## Features
@ -30,13 +30,13 @@ The secrets management API building block brings several features to your applic
You can call the secrets API in your application code to retrieve and use secrets from Dapr supported secret stores. Watch [this video](https://www.youtube.com/watch?v=OtbYCBt9C34&t=1818) for an example of how the secrets management API can be used in your application.
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/OtbYCBt9C34?start=1818" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
{{< youtube id=OtbYCBt9C34 start=1818 >}}
For example, the diagram below shows an application requesting the secret called "mysecret" from a secret store called "vault" from a configured cloud secret store.
<img src="/images/secrets-overview-cloud-stores.png" width=600>
Applications can also use the secrets API to access secrets from a Kubernetes secret store. By default, Dapr enables a built-in [Kubernetes secret store in Kubernetes mode]({{< ref "kubernetes-secret-store.md" >}}), deployed via:
Applications can also use the secrets API to access secrets from a Kubernetes secret store. By default, Dapr enables a built-in [Kubernetes secret store in Kubernetes mode]({{% ref "kubernetes-secret-store" %}}), deployed via:
- The Helm defaults, or
- `dapr init -k`
@ -56,17 +56,17 @@ In Azure, you can configure Dapr to retrieve secrets using managed identities to
In the examples above, the application code did not have to change to get the same secret. Dapr uses the secret management components via the secrets management building block API.
[Try out the secrets API]({{< ref "#try-out-secrets-management" >}}) using one of our quickstarts or tutorials.
[Try out the secrets API]({{% ref "#try-out-secrets-management" %}}) using one of our quickstarts or tutorials.
### Reference secret stores in Dapr components
When configuring Dapr components such as state stores, you're often required to include credentials in components files. Alternatively, you can place the credentials within a Dapr supported secret store and reference the secret within the Dapr component. This is the preferred approach and recommended best practice, especially in production environments.
For more information, read [referencing secret stores in components]({{< ref component-secrets.md >}}).
For more information, read [referencing secret stores in components]({{% ref component-secrets %}}).
### Limit access to secrets
To provide more granular control on access to secrets, Dapr provides the ability to define scopes and restricting access permissions. Learn more about [using secret scoping]({{< ref secrets-scopes >}})
To provide more granular control on access to secrets, Dapr provides the ability to define scopes and restricting access permissions. Learn more about [using secret scoping]({{% ref secrets-scopes %}})
## Try out secrets management
@ -76,14 +76,14 @@ Want to put the Dapr secrets management API to the test? Walk through the follow
| Quickstart/tutorial | Description |
| ------------------- | ----------- |
| [Secrets management quickstart]({{< ref secrets-quickstart.md >}}) | Retrieve secrets in the application code from a configured secret store using the secrets management API. |
| [Secrets management quickstart]({{% ref secrets-quickstart %}}) | Retrieve secrets in the application code from a configured secret store using the secrets management API. |
| [Secret Store tutorial](https://github.com/dapr/quickstarts/tree/master/tutorials/secretstore) | Demonstrates the use of Dapr Secrets API to access secret stores. |
### Start managing secrets directly in your app
Want to skip the quickstarts? Not a problem. You can try out the secret management building block directly in your application to retrieve and manage secrets. After [Dapr is installed]({{< ref "getting-started/_index.md" >}}), you can begin using the secrets management API starting with [the secrets how-to guide]({{< ref howto-secrets.md >}}).
Want to skip the quickstarts? Not a problem. You can try out the secret management building block directly in your application to retrieve and manage secrets. After [Dapr is installed]({{% ref "getting-started/_index" %}}), you can begin using the secrets management API starting with [the secrets how-to guide]({{% ref howto-secrets %}}).
## Next steps
- Learn [how to use secret scoping]({{< ref secrets-scopes.md >}}).
- Read the [secrets API reference doc]({{< ref secrets_api.md >}}).
- Learn [how to use secret scoping]({{% ref secrets-scopes %}}).
- Read the [secrets API reference doc]({{% ref secrets_api %}}).

View File

@ -6,27 +6,25 @@ weight: 3000
description: "Use scoping to limit the secrets that can be read by your application from secret stores"
---
Once you [configure a secret store for your application]({{< ref setup-secret-store >}}), *any* secret defined within that store is accessible by default from the Dapr application.
Once you [configure a secret store for your application]({{% ref setup-secret-store %}}), *any* secret defined within that store is accessible by default from the Dapr application.
You can limit the Dapr application's access to specific secrets by defining secret scopes. Simply add a secret scope policy [to the application configuration]({{< ref configuration-concept.md >}}) with restrictive permissions.
You can limit the Dapr application's access to specific secrets by defining secret scopes. Simply add a secret scope policy [to the application configuration]({{% ref configuration-concept %}}) with restrictive permissions.
The secret scoping policy applies to any [secret store]({{< ref supported-secret-stores.md >}}), including:
The secret scoping policy applies to any [secret store]({{% ref supported-secret-stores %}}), including:
- A local secret store
- A Kubernetes secret store
- A public cloud secret store
For details on how to set up a [secret store]({{< ref setup-secret-store.md >}}), read [How To: Retrieve a secret]({{< ref howto-secrets.md >}}).
For details on how to set up a [secret store]({{% ref setup-secret-store %}}), read [How To: Retrieve a secret]({{% ref howto-secrets %}}).
Watch [this video](https://youtu.be/j99RN_nxExA?start=2272) for a demo on how to use secret scoping with your application.
<div class="embed-responsive embed-responsive-16by9">
<iframe width="688" height="430" src="https://www.youtube-nocookie.com/embed/j99RN_nxExA?start=2272" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{< youtube id=j99RN_nxExA start=2272 >}}
## Scenario 1 : Deny access to all secrets for a secret store
In this example, all secret access is denied to an application running on a Kubernetes cluster, which has a configured [Kubernetes secret store]({{< ref kubernetes-secret-store >}}) named `mycustomsecretstore`. Aside from the user-defined custom store, the example also configures the Kubernetes default store (named `kubernetes`) to ensure all secrets are denied access. [Learn more about the Kubernetes default secret store]({{< ref "kubernetes-secret-store.md#default-kubernetes-secret-store-component" >}}).
In this example, all secret access is denied to an application running on a Kubernetes cluster, which has a configured [Kubernetes secret store]({{% ref kubernetes-secret-store %}}) named `mycustomsecretstore`. Aside from the user-defined custom store, the example also configures the Kubernetes default store (named `kubernetes`) to ensure all secrets are denied access. [Learn more about the Kubernetes default secret store]({{% ref "kubernetes-secret-store#default-kubernetes-secret-store-component" %}}).
Define the following `appconfig.yaml` configuration and apply it to the Kubernetes cluster using the command `kubectl apply -f appconfig.yaml`.
@ -44,7 +42,7 @@ spec:
defaultAccess: deny
```
For applications that need to be denied access to the Kubernetes secret store, follow [these instructions]({{< ref kubernetes-overview.md >}}), and add the following annotation to the application pod:
For applications that need to be denied access to the Kubernetes secret store, follow [these instructions]({{% ref kubernetes-overview %}}), and add the following annotation to the application pod:
```yaml
dapr.io/config: appconfig
@ -69,7 +67,7 @@ spec:
allowedSecrets: ["secret1", "secret2"]
```
The default access to the `vault` secret store is `deny`, while some secrets are accessible by the application, based on the `allowedSecrets` list. [Learn how to apply configuration to the sidecar]({{< ref configuration-concept.md >}}).
The default access to the `vault` secret store is `deny`, while some secrets are accessible by the application, based on the `allowedSecrets` list. [Learn how to apply configuration to the sidecar]({{% ref configuration-concept %}}).
## Scenario 3: Deny access to certain sensitive secrets in a secret store
@ -88,7 +86,7 @@ spec:
deniedSecrets: ["secret1", "secret2"]
```
This example configuration explicitly denies access to `secret1` and `secret2` from the secret store named `vault` while allowing access to all other secrets. [Learn how to apply configuration to the sidecar]({{< ref configuration-concept.md >}}).
This example configuration explicitly denies access to `secret1` and `secret2` from the secret store named `vault` while allowing access to all other secrets. [Learn how to apply configuration to the sidecar]({{% ref configuration-concept %}}).
## Permission priority
@ -105,5 +103,5 @@ Scenarios | defaultAccess | allowedSecrets | deniedSecrets | permission
## Related links
- List of [secret stores]({{< ref supported-secret-stores.md >}})
- Overview of [secret stores]({{< ref setup-secret-store.md >}})
- List of [secret stores]({{% ref supported-secret-stores %}})
- Overview of [secret stores]({{% ref setup-secret-store %}})

View File

@ -8,7 +8,7 @@ description: Perform direct, secure, service-to-service method calls
{{% alert title="More about Dapr Service Invocation" color="primary" %}}
Learn more about how to use Dapr Service Invocation:
- Try the [Service Invocation quickstart]({{< ref serviceinvocation-quickstart.md >}}).
- Explore service invocation via any of the supporting [Dapr SDKs]({{< ref sdks >}}).
- Review the [Service Invocation API reference documentation]({{< ref service_invocation_api.md >}}).
- Try the [Service Invocation quickstart]({{% ref serviceinvocation-quickstart %}}).
- Explore service invocation via any of the supporting [Dapr SDKs]({{% ref sdks %}}).
- Review the [Service Invocation API reference documentation]({{% ref service_invocation_api %}}).
{{% /alert %}}

View File

@ -11,7 +11,7 @@ This article demonstrates how to deploy services each with an unique application
<img src="/images/building-block-service-invocation-example.png" width=1000 height=500 alt="Diagram showing service invocation of example service">
{{% alert title="Note" color="primary" %}}
If you haven't already, [try out the service invocation quickstart]({{< ref serviceinvocation-quickstart.md >}}) for a quick walk-through on how to use the service invocation API.
If you haven't already, [try out the service invocation quickstart]({{% ref serviceinvocation-quickstart %}}) for a quick walk-through on how to use the service invocation API.
{{% /alert %}}
@ -19,9 +19,9 @@ This article demonstrates how to deploy services each with an unique application
Dapr allows you to assign a global, unique ID for your app. This ID encapsulates the state for your application, regardless of the number of instances it may have.
{{< tabs Python JavaScript ".NET" Java Go Kubernetes >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Python" %}}
```bash
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- python3 checkout/app.py
@ -37,9 +37,9 @@ dapr run --app-id checkout --app-protocol https --dapr-http-port 3500 -- python3
dapr run --app-id order-processor --app-port 8001 --app-protocol https --dapr-http-port 3501 -- python3 order-processor/app.py
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```bash
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- npm start
@ -55,9 +55,9 @@ dapr run --app-id checkout --dapr-http-port 3500 --app-protocol https -- npm sta
dapr run --app-id order-processor --app-port 5001 --dapr-http-port 3501 --app-protocol https -- npm start
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
```bash
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- dotnet run
@ -73,9 +73,9 @@ dapr run --app-id checkout --dapr-http-port 3500 --app-protocol https -- dotnet
dapr run --app-id order-processor --app-port 7001 --dapr-http-port 3501 --app-protocol https -- dotnet run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```bash
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- java -jar target/CheckoutService-0.0.1-SNAPSHOT.jar
@ -91,9 +91,9 @@ dapr run --app-id checkout --dapr-http-port 3500 --app-protocol https -- java -j
dapr run --app-id order-processor --app-port 9001 --dapr-http-port 3501 --app-protocol https -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```bash
dapr run --app-id checkout --dapr-http-port 3500 -- go run .
@ -109,9 +109,9 @@ dapr run --app-id checkout --dapr-http-port 3500 --app-protocol https -- go run
dapr run --app-id order-processor --app-port 6006 --dapr-http-port 3501 --app-protocol https -- go run .
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Kubernetes" %}}
### Set an app-id when deploying to Kubernetes
@ -141,11 +141,11 @@ spec:
...
```
If your app uses a TLS connection, you can tell Dapr to invoke your app over TLS with the `app-protocol: "https"` annotation (full list [here]({{< ref arguments-annotations-overview.md >}})). Note that Dapr does not validate TLS certificates presented by the app.
If your app uses a TLS connection, you can tell Dapr to invoke your app over TLS with the `app-protocol: "https"` annotation (full list [here]({{% ref arguments-annotations-overview %}})). Note that Dapr does not validate TLS certificates presented by the app.
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Invoke the service
@ -153,9 +153,9 @@ To invoke an application using Dapr, you can use the `invoke` API on any Dapr in
Below are code examples that leverage Dapr SDKs for service invocation.
{{< tabs Python JavaScript ".NET" Java Go >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
@ -180,9 +180,9 @@ while True:
logging.info('Result: ' + str(result))
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
//dependencies
@ -215,9 +215,9 @@ function sleep(ms) {
main();
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
//dependencies
@ -256,9 +256,9 @@ namespace EventService
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
//dependencies
@ -311,9 +311,9 @@ public class CheckoutServiceApplication {
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
package main
@ -367,9 +367,9 @@ func main() {
}
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
### Additional URL formats
@ -418,7 +418,7 @@ curl 'http://dapr-app-id:checkout@localhost:3602/checkout/100?basket=1234&key=ab
### Namespaces
When running on [namespace supported platforms]({{< ref "service_invocation_api.md#namespace-supported-platforms" >}}), you include the namespace of the target app in the app ID. For example, following the `<app>.<namespace>` format, use `checkout.production`.
When running on [namespace supported platforms]({{% ref "service_invocation_api#namespace-supported-platforms" %}}), you include the namespace of the target app in the app ID. For example, following the `<app>.<namespace>` format, use `checkout.production`.
Using this example, invoking the service with a namespace would look like:
@ -426,7 +426,7 @@ Using this example, invoking the service with a namespace would look like:
curl http://localhost:3602/v1.0/invoke/checkout.production/method/checkout/100 -X POST
```
See the [Cross namespace API spec]({{< ref "service_invocation_api.md#cross-namespace-invocation" >}}) for more information on namespaces.
See the [Cross namespace API spec]({{% ref "service_invocation_api#cross-namespace-invocation" %}}) for more information on namespaces.
## View traces and logs
@ -436,9 +436,9 @@ Our example above showed you how to directly invoke a different service running
- Allows you to visualize a call graph between services and log errors, and
- Optionally, log the payload body.
For more information on tracing and logs, see the [observability]({{< ref observability-concept.md >}}) article.
For more information on tracing and logs, see the [observability]({{% ref observability-concept %}}) article.
## Related Links
- [Service invocation overview]({{< ref service-invocation-overview.md >}})
- [Service invocation API specification]({{< ref service_invocation_api.md >}})
- [Service invocation overview]({{% ref service-invocation-overview %}})
- [Service invocation API specification]({{% ref service_invocation_api %}})

View File

@ -8,7 +8,7 @@ weight: 40
This article demonstrates how to call a non-Dapr endpoint using Dapr over HTTP.
Using Dapr's service invocation API, you can communicate with endpoints that either use or do not use Dapr. Using Dapr to call endpoints that do not use Dapr not only provides a consistent API, but also the following [Dapr service invocation]({{< ref service-invocation-overview.md >}}) benefits:
Using Dapr's service invocation API, you can communicate with endpoints that either use or do not use Dapr. Using Dapr to call endpoints that do not use Dapr not only provides a consistent API, but also the following [Dapr service invocation]({{% ref service-invocation-overview %}}) benefits:
- Ability to apply resiliency policies
- Call observability with tracing & metrics
@ -45,7 +45,7 @@ The diagram below is an overview of how Dapr's service invocation works when inv
## Using an HTTPEndpoint resource or FQDN URL for non-Dapr endpoints
There are two ways to invoke a non-Dapr endpoint when communicating either to Dapr applications or non-Dapr applications. A Dapr application can invoke a non-Dapr endpoint by providing one of the following:
- A named `HTTPEndpoint` resource, including defining an `HTTPEndpoint` resource type. See the [HTTPEndpoint reference]({{< ref httpendpoints-schema.md >}}) guide for an example.
- A named `HTTPEndpoint` resource, including defining an `HTTPEndpoint` resource type. See the [HTTPEndpoint reference]({{% ref httpendpoints-schema %}}) guide for an example.
```sh
localhost:3500/v1.0/invoke/<HTTPEndpoint-name>/method/<my-method>
@ -68,7 +68,7 @@ There are two ways to invoke a non-Dapr endpoint when communicating either to Da
```
### Using appId when calling Dapr enabled applications
AppIDs are always used to call Dapr applications with the `appID` and `my-method`. Read the [How-To: Invoke services using HTTP]({{< ref howto-invoke-discover-services.md >}}) guide for more information. For example:
AppIDs are always used to call Dapr applications with the `appID` and `my-method`. Read the [How-To: Invoke services using HTTP]({{% ref howto-invoke-discover-services %}}) guide for more information. For example:
```sh
localhost:3500/v1.0/invoke/<appID>/method/<my-method>
@ -79,7 +79,7 @@ curl http://localhost:3602/v1.0/invoke/orderprocessor/method/checkout
## TLS authentication
Using the [HTTPEndpoint resource]({{< ref httpendpoints-schema.md >}}) allows you to use any combination of a root certificate, client certificate and private key according to the authentication requirements of the remote endpoint.
Using the [HTTPEndpoint resource]({{% ref httpendpoints-schema %}}) allows you to use any combination of a root certificate, client certificate and private key according to the authentication requirements of the remote endpoint.
### Example using root certificate
@ -125,12 +125,11 @@ spec:
## Related Links
- [HTTPEndpoint reference]({{< ref httpendpoints-schema.md >}})
- [Service invocation overview]({{< ref service-invocation-overview.md >}})
- [Service invocation API specification]({{< ref service_invocation_api.md >}})
- [HTTPEndpoint reference]({{% ref httpendpoints-schema %}})
- [Service invocation overview]({{% ref service-invocation-overview %}})
- [Service invocation API specification]({{% ref service_invocation_api %}})
## Community call demo
Watch this [video](https://youtu.be/BEXJgLsO4hA?t=364) on how to use service invocation to call non-Dapr endpoints.
<div class="embed-responsive embed-responsive-16by9">
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/BEXJgLsO4hA?t=364" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{< youtube id=BEXJgLsO4hA start=364 >}}

View File

@ -8,7 +8,7 @@ weight: 30
This article describe how to use Dapr to connect services using gRPC.
By using Dapr's gRPC proxying capability, you can use your existing proto-based gRPC services and have the traffic go through the Dapr sidecar. Doing so yields the following [Dapr service invocation]({{< ref service-invocation-overview.md >}}) benefits to developers:
By using Dapr's gRPC proxying capability, you can use your existing proto-based gRPC services and have the traffic go through the Dapr sidecar. Doing so yields the following [Dapr service invocation]({{% ref service-invocation-overview %}}) benefits to developers:
1. Mutual authentication
2. Tracing
@ -126,9 +126,9 @@ ctx = metadata.AppendToOutgoingContext(ctx, "dapr-app-id", "server")
All languages supported by gRPC allow for adding metadata. Here are a few examples:
{{< tabs Java ".NET" Python JavaScript Ruby "C++">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Java" %}}
```java
Metadata headers = new Metadata();
Metadata.Key<String> jwtKey = Metadata.Key.of("dapr-app-id", "server");
@ -137,9 +137,9 @@ GreeterService.ServiceBlockingStub stub = GreeterService.newBlockingStub(channel
stub = MetadataUtils.attachHeaders(stub, header);
stub.SayHello(new HelloRequest() { Name = "Darth Malak" });
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
var metadata = new Metadata
{
@ -148,39 +148,39 @@ var metadata = new Metadata
var call = client.SayHello(new HelloRequest { Name = "Darth Nihilus" }, metadata);
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
metadata = (('dapr-app-id', 'server'),)
response = stub.SayHello(request={ name: 'Darth Revan' }, metadata=metadata)
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
const metadata = new grpc.Metadata();
metadata.add('dapr-app-id', 'server');
client.sayHello({ name: "Darth Malgus" }, metadata)
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Ruby" %}}
```ruby
metadata = { 'dapr-app-id' : 'server' }
response = service.sayHello({ 'name': 'Darth Bane' }, metadata)
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "C++" %}}
```c++
grpc::ClientContext context;
context.AddMetadata("dapr-app-id", "server");
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
### Run the client using the Dapr CLI
@ -223,11 +223,11 @@ spec:
The `dapr.io/app-protocol: "grpc"` annotation tells Dapr to invoke the app using gRPC.
If your app uses a TLS connection, you can tell Dapr to invoke your app over TLS with the `app-protocol: "grpcs"` annotation (full list [here]({{< ref arguments-annotations-overview.md >}})). Note that Dapr does not validate TLS certificates presented by the app.
If your app uses a TLS connection, you can tell Dapr to invoke your app over TLS with the `app-protocol: "grpcs"` annotation (full list [here]({{% ref arguments-annotations-overview %}})). Note that Dapr does not validate TLS certificates presented by the app.
### Namespaces
When running on [namespace supported platforms]({{< ref "service_invocation_api.md#namespace-supported-platforms" >}}), you include the namespace of the target app in the app ID: `myApp.production`
When running on [namespace supported platforms]({{% ref "service_invocation_api#namespace-supported-platforms" %}}), you include the namespace of the target app in the app ID: `myApp.production`
For example, invoking the gRPC server on a different namespace:
@ -235,13 +235,13 @@ For example, invoking the gRPC server on a different namespace:
ctx = metadata.AppendToOutgoingContext(ctx, "dapr-app-id", "server.production")
```
See the [Cross namespace API spec]({{< ref "service_invocation_api.md#cross-namespace-invocation" >}}) for more information on namespaces.
See the [Cross namespace API spec]({{% ref "service_invocation_api#cross-namespace-invocation" %}}) for more information on namespaces.
## Step 3: View traces and logs
The example above showed you how to directly invoke a different service running locally or in Kubernetes. Dapr outputs metrics, tracing and logging information allowing you to visualize a call graph between services, log errors and optionally log the payload body.
For more information on tracing and logs see the [observability]({{< ref observability-concept.md >}}) article.
For more information on tracing and logs see the [observability]({{% ref observability-concept %}}) article.
## Proxying of streaming RPCs
@ -249,24 +249,24 @@ When using Dapr to proxy streaming RPC calls using gRPC, you must set an additio
For example:
{{< tabs Go Java ".NET" Python JavaScript Ruby "C++">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Go" %}}
```go
ctx = metadata.AppendToOutgoingContext(ctx, "dapr-app-id", "server")
ctx = metadata.AppendToOutgoingContext(ctx, "dapr-stream", "true")
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
Metadata headers = new Metadata();
Metadata.Key<String> jwtKey = Metadata.Key.of("dapr-app-id", "server");
Metadata.Key<String> jwtKey = Metadata.Key.of("dapr-stream", "true");
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
var metadata = new Metadata
{
@ -274,44 +274,44 @@ var metadata = new Metadata
{ "dapr-stream", "true" }
};
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
metadata = (('dapr-app-id', 'server'), ('dapr-stream', 'true'),)
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
const metadata = new grpc.Metadata();
metadata.add('dapr-app-id', 'server');
metadata.add('dapr-stream', 'true');
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Ruby" %}}
```ruby
metadata = { 'dapr-app-id' : 'server' }
metadata = { 'dapr-stream' : 'true' }
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "C++" %}}
```c++
grpc::ClientContext context;
context.AddMetadata("dapr-app-id", "server");
context.AddMetadata("dapr-stream", "true");
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
### Streaming gRPCs and Resiliency
> Currently, resiliency policies are not supported for service invocation via gRPC.
When proxying streaming gRPCs, due to their long-lived nature, [resiliency]({{< ref "resiliency-overview.md" >}}) policies are applied on the "initial handshake" only. As a consequence:
When proxying streaming gRPCs, due to their long-lived nature, [resiliency]({{% ref "resiliency-overview" %}}) policies are applied on the "initial handshake" only. As a consequence:
- If the stream is interrupted after the initial handshake, it will not be automatically re-established by Dapr. Your application will be notified that the stream has ended, and will need to recreate it.
- Retry policies only impact the initial connection "handshake". If your resiliency policy includes retries, Dapr will detect failures in establishing the initial connection to the target app and will retry until it succeeds (or until the number of retries defined in the policy is exhausted).
@ -319,15 +319,12 @@ When proxying streaming gRPCs, due to their long-lived nature, [resiliency]({{<
## Related Links
* [Service invocation overview]({{< ref service-invocation-overview.md >}})
* [Service invocation API specification]({{< ref service_invocation_api.md >}})
* [Service invocation overview]({{% ref service-invocation-overview %}})
* [Service invocation API specification]({{% ref service_invocation_api %}})
* [gRPC proxying community call video](https://youtu.be/B_vkXqptpXY?t=70)
## Community call demo
Watch this [video](https://youtu.be/B_vkXqptpXY?t=69) on how to use Dapr's gRPC proxying capability:
<div class="embed-responsive embed-responsive-16by9">
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/B_vkXqptpXY?start=69" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/B_vkXqptpXY?start=69" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
</div>
{{< youtube id=B_vkXqptpXY start=69 >}}

View File

@ -27,14 +27,14 @@ Dapr uses a sidecar architecture. To invoke an application using Dapr:
[The following overview video and demo](https://www.youtube.com/live/0y7ne6teHT4?si=mtLMrajE5wVXJYz8&t=3598) demonstrates how Dapr service invocation works.
<iframe width="560" height="315" src="https://www.youtube-nocookie.com/embed/0y7ne6teHT4?si=Flsd8PRlF8nYu693&amp;start=3598" title="YouTube video player" style="padding-bottom:25px;" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" allowfullscreen></iframe>
{{< youtube id=0y7ne6teHT4 start=3598 >}}
The diagram below is an overview of how Dapr's service invocation works between two Dapr-ized applications.
<img src="/images/service-invocation-overview.png" width=800 alt="Diagram showing the steps of service invocation">
1. Service A makes an HTTP or gRPC call targeting Service B. The call goes to the local Dapr sidecar.
2. Dapr discovers Service B's location using the [name resolution component]({{< ref supported-name-resolution >}}) which is running on the given [hosting platform]({{< ref "hosting" >}}).
2. Dapr discovers Service B's location using the [name resolution component]({{% ref supported-name-resolution %}}) which is running on the given [hosting platform]({{% ref "hosting" %}}).
3. Dapr forwards the message to Service B's Dapr sidecar
- **Note**: All calls between Dapr sidecars go over gRPC for performance. Only calls between services and Dapr sidecars can be either HTTP or gRPC.
4. Service B's Dapr sidecar forwards the request to the specified endpoint (or method) on Service B. Service B then runs its business logic code.
@ -42,28 +42,28 @@ The diagram below is an overview of how Dapr's service invocation works between
6. Dapr forwards the response to Service A's Dapr sidecar.
7. Service A receives the response.
You can also call non-Dapr HTTP endpoints using the service invocation API. For example, you may only use Dapr in part of an overall application, may not have access to the code to migrate an existing application to use Dapr, or simply need to call an external HTTP service. Read ["How-To: Invoke Non-Dapr Endpoints using HTTP"]({{< ref howto-invoke-non-dapr-endpoints.md >}}) for more information.
You can also call non-Dapr HTTP endpoints using the service invocation API. For example, you may only use Dapr in part of an overall application, may not have access to the code to migrate an existing application to use Dapr, or simply need to call an external HTTP service. Read ["How-To: Invoke Non-Dapr Endpoints using HTTP"]({{% ref howto-invoke-non-dapr-endpoints %}}) for more information.
## Features
Service invocation provides several features to make it easy for you to call methods between applications or to call external HTTP endpoints.
### HTTP and gRPC service invocation
- **HTTP**: If you're already using HTTP protocols in your application, using the Dapr HTTP header might be the easiest way to get started. You don't need to change your existing endpoint URLs; just add the `dapr-app-id` header and you're ready to go. For more information, see [Invoke Services using HTTP]({{< ref howto-invoke-discover-services.md >}}).
- **gRPC**: Dapr allows users to keep their own proto services and work natively with gRPC. This means that you can use service invocation to call your existing gRPC apps without having to include any Dapr SDKs or include custom gRPC services. For more information, see the [how-to tutorial for Dapr and gRPC]({{< ref howto-invoke-services-grpc.md >}}).
- **HTTP**: If you're already using HTTP protocols in your application, using the Dapr HTTP header might be the easiest way to get started. You don't need to change your existing endpoint URLs; just add the `dapr-app-id` header and you're ready to go. For more information, see [Invoke Services using HTTP]({{% ref howto-invoke-discover-services %}}).
- **gRPC**: Dapr allows users to keep their own proto services and work natively with gRPC. This means that you can use service invocation to call your existing gRPC apps without having to include any Dapr SDKs or include custom gRPC services. For more information, see the [how-to tutorial for Dapr and gRPC]({{% ref howto-invoke-services-grpc %}}).
### Service-to-service security
With the Dapr Sentry service, all calls between Dapr applications can be made secure with mutual (mTLS) authentication on hosted platforms, including automatic certificate rollover.
For more information read the [service-to-service security]({{< ref "security-concept.md#sidecar-to-sidecar-communication" >}}) article.
For more information read the [service-to-service security]({{% ref "security-concept#sidecar-to-sidecar-communication" %}}) article.
### Resiliency including retries
In the event of call failures and transient errors, service invocation provides a resiliency feature that performs automatic retries with backoff time periods. To find out more, see the [Resiliency article here]({{< ref resiliency-overview.md >}}).
In the event of call failures and transient errors, service invocation provides a resiliency feature that performs automatic retries with backoff time periods. To find out more, see the [Resiliency article here]({{% ref resiliency-overview %}}).
### Tracing and metrics with observability
By default, all calls between applications are traced and metrics are gathered to provide insights and diagnostics for applications. This is especially important in production scenarios, providing call graphs and metrics on the calls between your services. For more information read about [observability]({{< ref observability-concept.md >}}).
By default, all calls between applications are traced and metrics are gathered to provide insights and diagnostics for applications. This is especially important in production scenarios, providing call graphs and metrics on the calls between your services. For more information read about [observability]({{% ref observability-concept %}}).
### Access control
@ -74,11 +74,11 @@ With access policies, applications can control:
For example, you can restrict sensitive applications with personnel information from being accessed by unauthorized applications. Combined with service-to-service secure communication, you can provide for soft multi-tenancy deployments.
For more information read the [access control allow lists for service invocation]({{< ref invoke-allowlist.md >}}) article.
For more information read the [access control allow lists for service invocation]({{% ref invoke-allowlist %}}) article.
### Namespace scoping
You can scope applications to namespaces for deployment and security and call between services deployed to different namespaces. For more information, read the [Service invocation across namespaces]({{< ref "service-invocation-namespaces.md" >}}) article.
You can scope applications to namespaces for deployment and security and call between services deployed to different namespaces. For more information, read the [Service invocation across namespaces]({{% ref "service-invocation-namespaces" %}}) article.
### Round robin load balancing with mDNS
@ -92,7 +92,7 @@ The diagram below shows an example of how this works. If you have 1 instance of
### Swappable service discovery
Dapr can run on a variety of [hosting platforms]({{< ref hosting >}}). To enable swappable service discovery with service invocation, Dapr uses [name resolution components]({{< ref supported-name-resolution >}}). For example, the Kubernetes name resolution component uses the Kubernetes DNS service to resolve the location of other applications running in the cluster.
Dapr can run on a variety of [hosting platforms]({{% ref hosting %}}). To enable swappable service discovery with service invocation, Dapr uses [name resolution components]({{% ref supported-name-resolution %}}). For example, the Kubernetes name resolution component uses the Kubernetes DNS service to resolve the location of other applications running in the cluster.
Self-hosted machines can use the mDNS name resolution component. As an alternative, you can use the SQLite name resolution component to run Dapr on single-node environments and for local development scenarios. Dapr sidecars that are part of the cluster store their information in a SQLite database on the local machine.
@ -115,7 +115,7 @@ The diagram below demonstrates the six steps of data flow.
## Example Architecture
Following the above call sequence, suppose you have the applications as described in the [Hello World tutorial](https://github.com/dapr/quickstarts/blob/master/tutorials/hello-world/README.md), where a python app invokes a node.js app. In such a scenario, the python app would be "Service A" , and a Node.js app would be "Service B".
Following the above call sequence, suppose you have the applications as described in the [Hello World tutorial](https://github.com/dapr/quickstarts/blob/master/tutorials/hello-world/README), where a python app invokes a node.js app. In such a scenario, the python app would be "Service A" , and a Node.js app would be "Service B".
The diagram below shows sequence 1-7 again on a local machine showing the API calls:
@ -135,7 +135,7 @@ The Dapr docs contain multiple quickstarts that leverage the service invocation
| Quickstart/tutorial | Description |
| ------------------- | ----------- |
| [Service invocation quickstart]({{< ref serviceinvocation-quickstart.md >}}) | This quickstart gets you interacting directly with the service invocation building block. |
| [Service invocation quickstart]({{% ref serviceinvocation-quickstart %}}) | This quickstart gets you interacting directly with the service invocation building block. |
| [Hello world tutorial](https://github.com/dapr/quickstarts/blob/master/tutorials/hello-world/README.md) | This tutorial shows how to use both the service invocation and state management building blocks all running locally on your machine. |
| [Hello world kubernetes tutorial](https://github.com/dapr/quickstarts/blob/master/tutorials/hello-kubernetes/README.md) | This tutorial walks through using Dapr in kubernetes and covers both the service invocation and state management building blocks as well. |
@ -145,17 +145,17 @@ Want to skip the quickstarts? Not a problem. You can try out the service invocat
Invoke services using:
- **HTTP and gRPC service invocation** (recommended set up method)
- *HTTP* - Allows you to just add the `dapr-app-id` header and you're ready to get started. Read more on this here, [Invoke Services using HTTP.]({{< ref howto-invoke-discover-services.md >}})
- *gRPC* - For gRPC based applications, the service invocation API is also available. Run the gRPC server, then invoke services using the Dapr CLI. Read more on this in [Configuring Dapr to use gRPC]({{< ref grpc >}}) and [Invoke services using gRPC]({{< ref howto-invoke-services-grpc.md >}}).
- *HTTP* - Allows you to just add the `dapr-app-id` header and you're ready to get started. Read more on this here, [Invoke Services using HTTP.]({{% ref howto-invoke-discover-services %}})
- *gRPC* - For gRPC based applications, the service invocation API is also available. Run the gRPC server, then invoke services using the Dapr CLI. Read more on this in [Configuring Dapr to use gRPC]({{% ref grpc %}}) and [Invoke services using gRPC]({{% ref howto-invoke-services-grpc %}}).
- **Direct call to the API** - In addition to proxying, there's also an option to directly call the service invocation API to invoke a GET endpoint. Just update your address URL to `localhost:<dapr-http-port>` and you'll be able to directly call the API. You can also read more on this in the _Invoke Services using HTTP_ docs linked above under HTTP proxying.
- **SDKs** - If you're using a Dapr SDK, you can directly use service invocation through the SDK. Select the SDK you need and use the Dapr client to invoke a service. Read more on this in [Dapr SDKs]({{< ref sdks.md >}}).
- **SDKs** - If you're using a Dapr SDK, you can directly use service invocation through the SDK. Select the SDK you need and use the Dapr client to invoke a service. Read more on this in [Dapr SDKs]({{% ref sdks %}}).
For quick testing, try using the Dapr CLI for service invocation:
- **Dapr CLI command** - Once the Dapr CLI is set up, use `dapr invoke --method <method-name>` command along with the method flag and the method of interest. Read more on this in [Dapr CLI]({{< ref dapr-invoke.md >}}).
- **Dapr CLI command** - Once the Dapr CLI is set up, use `dapr invoke --method <method-name>` command along with the method flag and the method of interest. Read more on this in [Dapr CLI]({{% ref dapr-invoke %}}).
## Next steps
- Read the [service invocation API specification]({{< ref service_invocation_api.md >}}). This reference guide for service invocation describes how to invoke methods on other services.
- Understand the [service invocation performance numbers]({{< ref perf-service-invocation.md >}}).
- Take a look at [observability]({{< ref observability >}}). Here you can dig into Dapr's monitoring tools like tracing, metrics and logging.
- Read up on our [security practices]({{< ref security-concept.md >}}) around mTLS encryption, token authentication, and endpoint authorization.
- Read the [service invocation API specification]({{% ref service_invocation_api %}}). This reference guide for service invocation describes how to invoke methods on other services.
- Understand the [service invocation performance numbers]({{% ref perf-service-invocation %}}).
- Take a look at [observability]({{% ref observability %}}). Here you can dig into Dapr's monitoring tools like tracing, metrics and logging.
- Read up on our [security practices]({{% ref security-concept %}}) around mTLS encryption, token authentication, and endpoint authorization.

View File

@ -8,8 +8,8 @@ description: Create long running stateful services
{{% alert title="More about Dapr State Management" color="primary" %}}
Learn more about how to use Dapr State Management:
- Try the [State Management quickstart]({{< ref statemanagement-quickstart.md >}}).
- Explore state management via any of the supporting [Dapr SDKs]({{< ref sdks >}}).
- Review the [State Management API reference documentation]({{< ref state_api.md >}}).
- Browse the supported [state management component specs]({{< ref supported-state-stores >}}).
- Try the [State Management quickstart]({{% ref statemanagement-quickstart %}}).
- Explore state management via any of the supporting [Dapr SDKs]({{% ref sdks %}}).
- Review the [State Management API reference documentation]({{% ref state_api %}}).
- Browse the supported [state management component specs]({{% ref supported-state-stores %}}).
{{% /alert %}}

View File

@ -93,6 +93,6 @@ when you rotate a key, data encrypted with the old key is not automatically re-e
## Related links
- [Security overview]({{< ref "security-concept.md" >}})
- [Security overview]({{% ref "security-concept" %}})
- [State store query API implementation guide](https://github.com/dapr/components-contrib/blob/master/state/README.md#implementing-state-query-api)
- [State store components]({{< ref "supported-state-stores.md" >}})
- [State store components]({{% ref "supported-state-stores" %}})

View File

@ -18,11 +18,11 @@ The code example below _loosely_ describes an application that processes orders
A state store component represents a resource that Dapr uses to communicate with a database.
For the purpose of this guide we'll use a Redis state store, but any state store from the [supported list]({{< ref supported-state-stores >}}) will work.
For the purpose of this guide we'll use a Redis state store, but any state store from the [supported list]({{% ref supported-state-stores %}}) will work.
{{< tabs "Self-Hosted (CLI)" Kubernetes>}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Self-Hosted (CLI)" %}}
When you run `dapr init` in self-hosted mode, Dapr creates a default Redis `statestore.yaml` and runs a Redis state store on your local machine, located:
@ -31,11 +31,11 @@ When you run `dapr init` in self-hosted mode, Dapr creates a default Redis `stat
With the `statestore.yaml` component, you can easily swap out underlying components without application code changes.
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Kubernetes" %}}
To deploy this into a Kubernetes cluster, fill in the `metadata` connection details of your [state store component]({{< ref supported-state-stores >}}) in the YAML below, save as `statestore.yaml`, and run `kubectl apply -f statestore.yaml`.
To deploy this into a Kubernetes cluster, fill in the `metadata` connection details of your [state store component]({{% ref supported-state-stores %}}) in the YAML below, save as `statestore.yaml`, and run `kubectl apply -f statestore.yaml`.
```yaml
apiVersion: dapr.io/v1alpha1
@ -52,11 +52,11 @@ spec:
value: ""
```
See [how to setup different state stores on Kubernetes]({{< ref "setup-state-store" >}}).
See [how to setup different state stores on Kubernetes]({{% ref "setup-state-store" %}}).
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
{{% alert title="Important" color="warning" %}}
Set an `app-id`, as the state keys are prefixed with this value. If you don't set an `app-id`, one is generated for you at runtime. The next time you run the command, a new `app-id` is generated and you will no longer have access to the previously saved state.
@ -66,9 +66,9 @@ Set an `app-id`, as the state keys are prefixed with this value. If you don't se
The following example shows how to save and retrieve a single key/value pair using the Dapr state management API.
{{< tabs ".NET" Java Python Go JavaScript "HTTP API (Bash)" "HTTP API (PowerShell)">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
@ -102,9 +102,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 dotnet run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
//dependencies
@ -150,9 +150,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 mvn spring-boot:run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
@ -183,9 +183,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 -- python3 OrderProcessingService.py
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
// dependencies
@ -231,9 +231,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 go run OrderProcessingService.go
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
//dependencies
@ -287,9 +287,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 npm start
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (Bash)" %}}
Launch a Dapr sidecar:
@ -311,9 +311,9 @@ curl http://localhost:3601/v1.0/state/statestore/order_1
Restart your sidecar and try retrieving state again to observe that state persists separately from the app.
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
Launch a Dapr sidecar:
@ -335,17 +335,17 @@ Invoke-RestMethod -Uri 'http://localhost:3601/v1.0/state/statestore/order_1'
Restart your sidecar and try retrieving state again to observe that state persists separately from the app.
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Delete state
Below are code examples that leverage Dapr SDKs for deleting the state.
{{< tabs ".NET" Java Python Go JavaScript "HTTP API (Bash)" "HTTP API (PowerShell)">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using Dapr.Client;
@ -370,9 +370,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 dotnet run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
//dependencies
@ -400,9 +400,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 mvn spring-boot:run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
@ -423,9 +423,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 -- python3 OrderProcessingService.py
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
//dependencies
@ -458,9 +458,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 go run OrderProcessingService.go
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
//dependencies
@ -489,9 +489,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 npm start
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (Bash)" %}}
With the same Dapr instance running from above, run:
@ -501,9 +501,9 @@ curl -X DELETE 'http://localhost:3601/v1.0/state/statestore/order_1'
Try getting state again. Note that no value is returned.
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
With the same Dapr instance running from above, run:
@ -513,17 +513,17 @@ Invoke-RestMethod -Method Delete -Uri 'http://localhost:3601/v1.0/state/statesto
Try getting state again. Note that no value is returned.
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Save and retrieve multiple states
Below are code examples that leverage Dapr SDKs for saving and retrieving multiple states.
{{< tabs ".NET" Java Python Go JavaScript "HTTP API (Bash)" "HTTP API (PowerShell)">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using Dapr.Client;
@ -567,9 +567,9 @@ IReadOnlyList<BulkStateItem<Widget>> mulitpleStateResult = await client.GetBulkS
record Widget(string Size, string Color);
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
//dependencies
@ -600,9 +600,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 mvn spring-boot:run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
@ -626,9 +626,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 -- python3 OrderProcessingService.py
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
// dependencies
@ -676,9 +676,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 go run OrderProcessingService.go
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
//dependencies
@ -718,9 +718,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 npm start
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (Bash)" %}}
With the same Dapr instance running from above, save two key/value pairs into your statestore:
@ -734,9 +734,9 @@ Now get the states you just saved:
curl -X POST -H "Content-Type: application/json" -d '{"keys":["order_1", "order_2"]}' http://localhost:3601/v1.0/state/statestore/bulk
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
With the same Dapr instance running from above, save two key/value pairs into your statestore:
@ -750,21 +750,21 @@ Now get the states you just saved:
Invoke-RestMethod -Method Post -ContentType 'application/json' -Body '{"keys":["order_1", "order_2"]}' -Uri 'http://localhost:3601/v1.0/state/statestore/bulk'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Perform state transactions
{{% alert title="Note" color="primary" %}}
State transactions require a state store that supports multi-item transactions. See the [supported state stores page]({{< ref supported-state-stores >}}) for a full list.
State transactions require a state store that supports multi-item transactions. See the [supported state stores page]({{% ref supported-state-stores %}}) for a full list.
{{% /alert %}}
Below are code examples that leverage Dapr SDKs for performing state transactions.
{{< tabs ".NET" Java Python Go JavaScript "HTTP API (Bash)" "HTTP API (PowerShell)">}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab ".NET" %}}
```csharp
using Dapr.Client;
@ -806,9 +806,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 dotnet run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
```java
//dependencies
@ -859,9 +859,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 mvn spring-boot:run
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Python" %}}
```python
#dependencies
import random
@ -905,9 +905,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 -- python3 OrderProcessingService.py
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
```go
// dependencies
@ -978,9 +978,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 go run OrderProcessingService.go
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
```javascript
//dependencies
@ -1038,9 +1038,9 @@ To launch a Dapr sidecar for the above example application, run a command simila
dapr run --app-id orderprocessing --app-port 6001 --dapr-http-port 3601 --dapr-grpc-port 60001 npm start
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (Bash)" %}}
With the same Dapr instance running from above, perform two state transactions:
@ -1054,9 +1054,9 @@ Now see the results of your state transactions:
curl -X POST -H "Content-Type: application/json" -d '{"keys":["order_1", "order_2"]}' http://localhost:3601/v1.0/state/statestore/bulk
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
With the same Dapr instance running from above, save two key/value pairs into your statestore:
@ -1070,12 +1070,12 @@ Now see the results of your state transactions:
Invoke-RestMethod -Method Post -ContentType 'application/json' -Body '{"keys":["order_1", "order_2"]}' -Uri 'http://localhost:3601/v1.0/state/statestore/bulk'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
## Next steps
- Read the full [State API reference]({{< ref state_api.md >}})
- Try one of the [Dapr SDKs]({{< ref sdks >}})
- Build a [stateful service]({{< ref howto-stateful-service.md >}})
- Read the full [State API reference]({{% ref state_api %}})
- Try one of the [Dapr SDKs]({{% ref sdks %}})
- Build a [stateful service]({{% ref howto-stateful-service %}})

View File

@ -14,7 +14,7 @@ For example, you can use the outbox pattern to:
1. Write a new user record to an account database.
1. Send a notification message that the account was successfully created.
With Dapr's outbox support, you can notify subscribers when an application's state is created or updated when calling Dapr's [transactions API]({{< ref "state_api.md#state-transactions" >}}).
With Dapr's outbox support, you can notify subscribers when an application's state is created or updated when calling Dapr's [transactions API]({{% ref "state_api.md#state-transactions" %}}).
The diagram below is an overview of how the outbox feature works:
@ -26,12 +26,12 @@ The diagram below is an overview of how the outbox feature works:
## Requirements
The outbox feature can be used with using any [transactional state store]({{< ref supported-state-stores >}}) supported by Dapr. All [pub/sub brokers]({{< ref supported-pubsub >}}) are supported with the outbox feature.
The outbox feature can be used with using any [transactional state store]({{% ref supported-state-stores %}}) supported by Dapr. All [pub/sub brokers]({{% ref supported-pubsub %}}) are supported with the outbox feature.
[Learn more about the transactional methods you can use.]({{< ref "howto-get-save-state.md#perform-state-transactions" >}})
[Learn more about the transactional methods you can use.]({{% ref "howto-get-save-state.md#perform-state-transactions" %}})
{{% alert title="Note" color="primary" %}}
Message brokers that work with the competing consumer pattern (for example, [Apache Kafka]({{< ref setup-apache-kafka>}})) are encouraged to reduce the chances of duplicate events.
Message brokers that work with the competing consumer pattern (for example, [Apache Kafka]({{% ref setup-apache-kafka%}})) are encouraged to reduce the chances of duplicate events.
{{% /alert %}}
## Enable the outbox pattern
@ -116,11 +116,11 @@ To use correctly, the `key` values must match between the operation on the state
If you have two or more `outbox.projection` enabled state items for the same key, the first one defined is used and the others are ignored.
[Learn more about default and custom CloudEvent messages.]({{< ref pubsub-cloudevents.md >}})
[Learn more about default and custom CloudEvent messages.]({{% ref pubsub-cloudevents.md %}})
{{< tabs Python JavaScript ".NET" Java Go HTTP >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Python" %}}
<!--python-->
@ -161,9 +161,9 @@ By setting the metadata item `"outbox.projection"` to `"true"` and making sure t
- The first operation is written to the state store and no message is written to the message broker.
- The second operation value is published to the configured pub/sub topic.
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
<!--javascript-->
@ -216,9 +216,9 @@ By setting the metadata item `"outbox.projection"` to `"true"` and making sure t
- The second operation value is published to the configured pub/sub topic.
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
<!--dotnet-->
@ -266,9 +266,9 @@ By setting the metadata item `"outbox.projection"` to `"true"` and making sure t
- The first operation is written to the state store and no message is written to the message broker.
- The second operation value is published to the configured pub/sub topic.
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
<!--java-->
@ -318,9 +318,9 @@ By setting the metadata item `"outbox.projection"` to `"true"` and making sure t
- The second operation value is published to the configured pub/sub topic.
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
<!--go-->
@ -356,9 +356,9 @@ By setting the metadata item `"outbox.projection"` to `"true"` and making sure t
- The first operation is written to the state store and no message is written to the message broker.
- The second operation value is published to the configured pub/sub topic.
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP" %}}
<!--http-->
@ -401,17 +401,17 @@ By setting the metadata item `"outbox.projection"` to `"true"` and making sure t
- The first operation is written to the state store and no message is written to the message broker.
- The second operation value is published to the configured pub/sub topic.
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
### Override Dapr-generated CloudEvent fields
You can override the [Dapr-generated CloudEvent fields]({{< ref "pubsub-cloudevents.md#dapr-generated-cloudevents-example" >}}) on the published outbox event with custom CloudEvent metadata.
You can override the [Dapr-generated CloudEvent fields]({{% ref "pubsub-cloudevents.md#dapr-generated-cloudevents-example" %}}) on the published outbox event with custom CloudEvent metadata.
{{< tabs Python JavaScript ".NET" Java Go HTTP >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "Python" %}}
<!--python-->
@ -450,9 +450,9 @@ async def execute_state_transaction():
if __name__ == "__main__":
asyncio.run(execute_state_transaction())
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "JavaScript" %}}
<!--javascript-->
@ -490,9 +490,9 @@ async function executeStateTransaction() {
executeStateTransaction();
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab ".NET" %}}
<!--csharp-->
@ -541,9 +541,9 @@ public class StateOperationExample
}
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Java" %}}
<!--java-->
@ -589,9 +589,9 @@ public class StateOperationExample {
}
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "Go" %}}
<!--go-->
@ -638,9 +638,9 @@ func main() {
log.Println("State transaction executed.")
}
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP" %}}
<!--http-->
@ -667,9 +667,9 @@ curl -X POST http://localhost:3500/v1.0/state/starwars/transaction \
}'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
{{% alert title="Note" color="primary" %}}
@ -681,5 +681,4 @@ The `data` CloudEvent field is reserved for Dapr's use only, and is non-customiz
Watch [this video for an overview of the outbox pattern](https://youtu.be/rTovKpG0rhY?t=1338):
<div class="embed-responsive embed-responsive-16by9">
<iframe width="360" height="315" src="https://www.youtube-nocookie.com/embed/rTovKpG0rhY?si=1xlS54vcdYnLLtOL&amp;start=1338" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>
{{< youtube id=rTovKpG0rhY start=1338 >}}

View File

@ -21,7 +21,7 @@ To enable state sharing, Dapr supports the following key prefixes strategies:
| ------------ | ----------- |
| `appid` | The default strategy allowing you to manage state only by the app with the specified `appid`. All state keys will be prefixed with the `appid`, and are scoped for the application. |
| `name` | Uses the name of the state store component as the prefix. Multiple applications can share the same state for a given state store. |
| `namespace` | If set, this setting prefixes the `appid` key with the configured namespace, resulting in a key that is scoped to a given namespace. This allows apps in different namespace with the same `appid` to reuse the same state store. If a namespace is not configured, the setting fallbacks to the `appid` strategy. For more information on namespaces in Dapr see [How-To: Scope components to one or more applications]({{< ref component-scopes.md >}}) |
| `namespace` | If set, this setting prefixes the `appid` key with the configured namespace, resulting in a key that is scoped to a given namespace. This allows apps in different namespace with the same `appid` to reuse the same state store. If a namespace is not configured, the setting fallbacks to the `appid` strategy. For more information on namespaces in Dapr see [How-To: Scope components to one or more applications]({{% ref component-scopes.md %}}) |
| `none` | Uses no prefixing. Multiple applications share state across different state stores. |
## Specifying a state prefix strategy

View File

@ -150,25 +150,25 @@ ORDER BY
Execute the query with the following command:
{{< tabs "HTTP API (Bash)" "HTTP API (PowerShell)" >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "HTTP API (Bash)" %}}
```bash
curl -s -X POST -H "Content-Type: application/json" -d @query-api-examples/query1.json http://localhost:3500/v1.0-alpha1/state/statestore/query | jq .
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
```powershell
Invoke-RestMethod -Method Post -ContentType 'application/json' -InFile query-api-examples/query1.json -Uri 'http://localhost:3500/v1.0-alpha1/state/statestore/query'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
The query result is an array of matching key/value pairs in the requested order:
@ -250,25 +250,25 @@ SELECT * FROM c WHERE
Execute the query with the following command:
{{< tabs "HTTP API (Bash)" "HTTP API (PowerShell)" >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "HTTP API (Bash)" %}}
```bash
curl -s -X POST -H "Content-Type: application/json" -d @query-api-examples/query2.json http://localhost:3500/v1.0-alpha1/state/statestore/query | jq .
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
```powershell
Invoke-RestMethod -Method Post -ContentType 'application/json' -InFile query-api-examples/query2.json -Uri 'http://localhost:3500/v1.0-alpha1/state/statestore/query'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
Similar to the previous example, the result is an array of matching key/value pairs.
@ -331,25 +331,25 @@ LIMIT 3
Execute the query with the following command:
{{< tabs "HTTP API (Bash)" "HTTP API (PowerShell)" >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "HTTP API (Bash)" %}}
```bash
curl -s -X POST -H "Content-Type: application/json" -d @query-api-examples/query3.json http://localhost:3500/v1.0-alpha1/state/statestore/query | jq .
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
```powershell
Invoke-RestMethod -Method Post -ContentType 'application/json' -InFile query-api-examples/query3.json -Uri 'http://localhost:3500/v1.0-alpha1/state/statestore/query'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
Upon successful execution, the state store returns a JSON object with a list of matching records and the pagination token:
@ -434,25 +434,25 @@ The pagination token is used "as is" in the [subsequent query](../query-api-exam
}
```
{{< tabs "HTTP API (Bash)" "HTTP API (PowerShell)" >}}
{{< tabpane text=true >}}
{{% codetab %}}
{{% tab "HTTP API (Bash)" %}}
```bash
curl -s -X POST -H "Content-Type: application/json" -d @query-api-examples/query3-token.json http://localhost:3500/v1.0-alpha1/state/statestore/query | jq .
```
{{% /codetab %}}
{{% /tab %}}
{{% codetab %}}
{{% tab "HTTP API (PowerShell)" %}}
```powershell
Invoke-RestMethod -Method Post -ContentType 'application/json' -InFile query-api-examples/query3-token.json -Uri 'http://localhost:3500/v1.0-alpha1/state/statestore/query'
```
{{% /codetab %}}
{{% /tab %}}
{{< /tabs >}}
{{< /tabpane >}}
And the result of this query is:
@ -506,14 +506,14 @@ That way you can update the pagination token in the query and iterate through th
The state query API has the following limitations:
- To query actor states stored in a state store, you need to use the query API for the specific database. See [querying actor state]({{< ref "state-management-overview.md#querying-actor-state" >}}).
- The API does not work with Dapr [encrypted state stores]({{< ref howto-encrypt-state >}}) capability. Since the encryption is done by the Dapr runtime and stored as encrypted data, then this effectively prevents server side querying.
- To query actor states stored in a state store, you need to use the query API for the specific database. See [querying actor state]({{% ref "state-management-overview.md#querying-actor-state" %}}).
- The API does not work with Dapr [encrypted state stores]({{% ref howto-encrypt-state %}}) capability. Since the encryption is done by the Dapr runtime and stored as encrypted data, then this effectively prevents server side querying.
You can find additional information in the [related links]({{< ref "#related-links" >}}) section.
You can find additional information in the [related links]({{% ref "#related-links" %}}) section.
## Related links
- Refer to the [query API reference]({{< ref "state_api.md#state-query" >}}).
- See the [state store components that implement query support]({{< ref supported-state-stores.md >}}).
- Refer to the [query API reference]({{% ref "state_api.md#state-query" %}}).
- See the [state store components that implement query support]({{% ref supported-state-stores.md %}}).
- View the [state store query API implementation guide](https://github.com/dapr/components-contrib/blob/master/state/README.md#implementing-state-query-api).
- See how to [query Redis state store]({{< ref "setup-redis.md#querying-json-objects" >}}).
- See how to [query Redis state store]({{% ref "setup-redis.md#querying-json-objects" %}}).

View File

@ -22,11 +22,11 @@ When you run `dapr init` in self-hosted mode, Dapr creates a default Redis `stat
With the `statestore.yaml` component, you can easily swap out underlying components without application code changes.
See a [list of supported state stores]({{< ref supported-state-stores >}}).
See a [list of supported state stores]({{% ref supported-state-stores %}}).
### Kubernetes
See [how to setup different state stores on Kubernetes]({{<ref setup-state-store>}}).
See [how to setup different state stores on Kubernetes]({{%ref setup-state-store%}}).
## Strong and eventual consistency

View File

@ -6,4 +6,4 @@ weight: 500
description: "Guides for working with specific backend states stores"
---
Explore the **Operations** section to see a list of [supported state stores]({{< ref supported-state-stores.md >}}) and how to setup [state store components]({{< ref setup-state-store.md >}}).
Explore the **Operations** section to see a list of [supported state stores]({{% ref supported-state-stores.md %}}) and how to setup [state store components]({{% ref setup-state-store.md %}}).

View File

@ -6,7 +6,7 @@ weight: 1000
description: "Use Azure Cosmos DB as a state store"
---
Dapr doesn't transform state values while saving and retrieving states. Dapr requires all state store implementations to abide by a certain key format scheme (see [the state management spec]({{< ref state_api.md >}}). You can directly interact with the underlying store to manipulate the state data, such as:
Dapr doesn't transform state values while saving and retrieving states. Dapr requires all state store implementations to abide by a certain key format scheme (see [the state management spec]({{% ref state_api.md %}}). You can directly interact with the underlying store to manipulate the state data, such as:
- Querying states.
- Creating aggregated views.

View File

@ -6,7 +6,7 @@ weight: 2000
description: "Use Redis as a state store"
---
Dapr doesn't transform state values while saving and retrieving states. Dapr requires all state store implementations to abide by a certain key format scheme (see [the state management spec]({{< ref state_api.md >}}). You can directly interact with the underlying store to manipulate the state data, such as:
Dapr doesn't transform state values while saving and retrieving states. Dapr requires all state store implementations to abide by a certain key format scheme (see [the state management spec]({{% ref state_api.md %}}). You can directly interact with the underlying store to manipulate the state data, such as:
- Querying states.
- Creating aggregated views.

View File

@ -6,7 +6,7 @@ weight: 3000
description: "Use SQL server as a backend state store"
---
Dapr doesn't transform state values while saving and retrieving states. Dapr requires all state store implementations to abide by a certain key format scheme (see [the state management spec]({{< ref state_api.md >}}). You can directly interact with the underlying store to manipulate the state data, such as:
Dapr doesn't transform state values while saving and retrieving states. Dapr requires all state store implementations to abide by a certain key format scheme (see [the state management spec]({{% ref state_api.md %}}). You can directly interact with the underlying store to manipulate the state data, such as:
- Querying states.
- Creating aggregated views.

Some files were not shown because too many files have changed in this diff Show More