use orderIds for example

Signed-off-by: Sarthak Sharma <sartsharma@microsoft.com>
This commit is contained in:
Sarthak Sharma 2022-11-08 17:39:48 +05:30
parent 991d6bf86c
commit 6f57eb5186
9 changed files with 135 additions and 32 deletions

View File

@ -0,0 +1,103 @@
#
# Copyright 2022 The Dapr Authors
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
# http://www.apache.org/licenses/LICENSE-2.0
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
name: Validate Configuration API
on:
workflow_dispatch:
push:
branches:
- master
- feature/new_quickstarts
- release-*
tags:
- v*
pull_request:
branches:
- master
- feature/new_quickstarts
- release-*
jobs:
validate:
name: Validate quickstart for `${{ matrix.quickstart_language }}` with `${{ matrix.quickstart_variant }}` on ${{ matrix.os }}
runs-on: ${{ matrix.os }}
env:
DAPR_INSTALL_URL: https://raw.githubusercontent.com/dapr/cli/master/install
GOVER: 1.17
KUBERNETES_VERSION: v1.21.1
KIND_VERSION: v0.11.0
KIND_IMAGE_SHA: sha256:69860bda5563ac81e3c0057d654b5253219618a22ec3a346306239bba8cfa1a6
strategy:
matrix:
os: [ubuntu-latest, macos-10.15]
quickstart_language: [go]
quickstart_variant: [http, sdk]
steps:
- name: Install docker - MacOS
if: matrix.os == 'macos-10.15'
uses: docker-practice/actions-setup-docker@v1
with:
docker_buildx: false
docker_version: 20.10
- name: Set up Go ${{ env.GOVER }}
uses: actions/setup-go@v2
with:
go-version: ${{ env.GOVER }}
- name: Set up OpenJDK 11
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: 11
- name: Install .NET Core
uses: actions/setup-dotnet@v1.9.0
with:
dotnet-version: |
6.0.x
- name: Determine latest Dapr Runtime version including Pre-releases
run: |
helm repo add dapr https://dapr.github.io/helm-charts/ && helm repo update && export RUNTIME_VERSION=$(helm search repo dapr/dapr --devel --versions | awk '/dapr\/dapr/ {print $3; exit}' )
echo "DAPR_RUNTIME_VERSION=$RUNTIME_VERSION" >> $GITHUB_ENV
echo "Found $RUNTIME_VERSION"
shell: bash
- name: Determine latest Dapr Cli version including Pre-releases
run: |
export CLI_VERSION=$(curl "https://api.github.com/repos/dapr/cli/releases?per_page=1&page=1" --header 'authorization: Bearer ${{ secrets.GITHUB_TOKEN }}' | jq '.[0].tag_name'| tr -d '",v')
echo "DAPR_CLI_VERSION=$CLI_VERSION" >> $GITHUB_ENV
echo "Found $CLI_VERSION"
shell: bash
- name: Set up Dapr CLI - Mac/Linux
if: matrix.os != 'windows-latest'
run: wget -q ${{ env.DAPR_INSTALL_URL }}/install.sh -O - | /bin/bash -s ${{ env.DAPR_CLI_VERSION }}
- name: Set up Dapr CLI - Windows
if: matrix.os == 'windows-latest'
run: powershell -Command "\$$script=iwr -useb ${{ env.DAPR_INSTALL_URL }}/install.ps1; \$$block=[ScriptBlock]::Create(\$$script); invoke-command -ScriptBlock \$$block -ArgumentList ${{ env.DAPR_CLI_VERSION }}"
- name: Install Dapr
run: |
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
dapr init --runtime-version=${{ env.DAPR_RUNTIME_VERSION }}
dapr --version
- name: Check out code
uses: actions/checkout@v2
- name: Install utilities dependencies
run: |
echo "PATH=$PATH:$HOME/.local/bin" >> $GITHUB_ENV
pip3 install setuptools wheel
pip3 install mechanical-markdown
- name: Validate ${{ matrix.quickstart_language }} ${{ matrix.quickstart_variant }} Configuration API
run: |
pushd configuration/${{ matrix.quickstart_language }}/${{ matrix.quickstart_variant }}
make validate
popd
- name: Linkcheck README.md
run: |
make validate

View File

@ -8,35 +8,35 @@ Visit [this](https://docs.dapr.io/developing-applications/building-blocks/config
This quickstart includes one service:
- Go service `config-subscriber`
- Go service `order-processor`
## Run config-updater app
## Run order-updater app
> **Note:** `config-updater` app adds configuration items to the configuration store and keeps updating their value to simulate dynamic changes to configuration data. You need to start and keep it running before running `config-subscriber` service.
> **Note:** `order-updater` app adds configuration items to the configuration store and keeps updating their value to simulate dynamic changes to configuration data. You need to start and keep it running before running `order-processor` service.
1. Navigate to [`config-updater`](./../../config-updater/) directory.
2. Check the [`Readme`](./../../config-updater/README.md) to start the app and keep it running in the terminal.
1. Navigate to [`order-updater`](./../../order-updater/) directory.
2. Check the [`Readme`](./../../order-updater/README.md) to start the app and keep it running in the terminal.
```bash
cd ./../../config-updater
cd ./../../order-updater
go run .
```
3. This will add configuration items to redis config store and keep updating their values.
## Run config-subscriber
## Run order-processor
1. Open a new terminal and navigate to `config-subscriber` directory.
1. Open a new terminal and navigate to `order-processor` directory.
2. Run the service app with Dapr.
<!-- STEP
name: Run config-subscriber service
name: Run order-processor service
expected_stdout_lines:
- '== APP == Configuration for appID1: {"appID1":{"value":'
- '== APP == Configuration for appID2: {"appID2":{"value":'
- '== APP == Configuration for orderId1: {"orderId1":{"value":'
- '== APP == Configuration for orderId2: {"orderId2":{"value":'
- '== APP == App subscribed to config changes with subscription id:'
- '== APP == Configuration update {"appID1":{"value":'
- '== APP == Configuration update {"appID2":{"value":'
- '== APP == Configuration update {"orderId1":{"value":'
- '== APP == Configuration update {"orderId2":{"value":'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
@ -46,8 +46,8 @@ sleep: 20
-->
```bash
cd ./config-subscriber
dapr run --app-id config-subscriber --app-port 6001 --components-path ../../../components -- go run .
cd ./order-processor
dapr run --app-id order-processor --app-port 6001 --components-path ../../../components -- go run .
```
<!-- END_STEP -->

View File

@ -17,7 +17,7 @@ var DAPR_HOST, DAPR_HTTP_PORT string
var okHost, okPort bool
var appPort = "6001"
var DAPR_CONFIGURATION_STORE = "configstore"
var CONFIGURATION_ITEMS = []string{"appID1", "appID2"}
var CONFIGURATION_ITEMS = []string{"orderId1", "orderId2"}
func main() {
if DAPR_HOST, okHost = os.LookupEnv("DAPR_HOST"); !okHost {

View File

@ -6,35 +6,35 @@ Visit [this](https://docs.dapr.io/developing-applications/building-blocks/config
This quickstart includes one service:
- Go service `config-subscriber`
- Go service `order-processor`
## Run config-updater app
## Run order-updater app
> **Note:** `config-updater` app adds configuration items to the configuration store and keeps updating their value to simulate dynamic changes to configuration data. You need to start and keep it running before running `config-subscriber` service.
> **Note:** `order-updater` app adds configuration items to the configuration store and keeps updating their value to simulate dynamic changes to configuration data. You need to start and keep it running before running `order-processor` service.
1. Navigate to [`config-updater`](./../../config-updater/) directory.
2. Check the [`Readme`](./../../config-updater/README.md) to start the app and keep it running in the terminal.
1. Navigate to [`order-updater`](./../../order-updater/) directory.
2. Check the [`Readme`](./../../order-updater/README.md) to start the app and keep it running in the terminal.
```bash
cd ./../../config-updater
cd ./../../order-updater
go run .
```
3. This will add configuration items to redis config store and keep updating their values.
## Run config-subscriber
## Run order-processor
1. Open a new terminal and navigate to `config-subscriber` directory.
1. Open a new terminal and navigate to `order-processor` directory.
2. Run the service app with Dapr.
<!-- STEP
name: Run config-subscriber service
name: Run order-processor service
expected_stdout_lines:
- '== APP == Configuration for appID1: {"Value":'
- '== APP == Configuration for appID2: {"Value":'
- '== APP == Configuration for orderId1: {"Value":'
- '== APP == Configuration for orderId2: {"Value":'
- '== APP == App subscribed to config changes with subscription id:'
- '== APP == Configuration update {"appID1":{"Value":'
- '== APP == Configuration update {"appID2":{"Value":'
- '== APP == Configuration update {"orderId1":{"Value":'
- '== APP == Configuration update {"orderId2":{"Value":'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
@ -44,8 +44,8 @@ sleep: 20
-->
```bash
cd ./config-subscriber
dapr run --app-id config-subscriber --app-port 6001 --components-path ../../../components -- go run .
cd ./order-processor
dapr run --app-id order-processor --app-port 6001 --components-path ../../../components -- go run .
```
<!-- END_STEP -->

View File

@ -12,7 +12,7 @@ import (
)
var DAPR_CONFIGURATION_STORE = "configstore"
var CONFIGURATION_ITEMS = []string{"appID1", "appID2"}
var CONFIGURATION_ITEMS = []string{"orderId1", "orderId2"}
func main() {
client, err := dapr.NewClient()