Merge branch 'v1.8' into upmerge_10-12

This commit is contained in:
Hannah Hunter 2022-10-12 18:39:53 -05:00
commit 5d02670f89
6 changed files with 48 additions and 44 deletions

View File

@ -47,7 +47,7 @@ For versions [2020.1](https://www.jetbrains.com/help/idea/2020.1/tuning-the-ide.
{{% codetab %}} {{% codetab %}}
```shell ```shell
~/Library/Application Support/JetBrains/IntelliJIdea2020.1/tools/ ~/Library/Application\ Support/JetBrains/IntelliJIdea2020.1/tools/
``` ```
{{% /codetab %}} {{% /codetab %}}
@ -58,7 +58,7 @@ For versions [2020.1](https://www.jetbrains.com/help/idea/2020.1/tuning-the-ide.
Change the version of IntelliJ in the path if needed. Change the version of IntelliJ in the path if needed.
Create or edit the file in `<CONFIG PATH>/tools/External\ Tools.xml` (change IntelliJ version in path if needed). The `<CONFIG PATH>` is OS dependennt as seen above. Create or edit the file in `<CONFIG PATH>/tools/External\ Tools.xml` (change IntelliJ version in path if needed). The `<CONFIG PATH>` is OS dependent as seen above.
Add a new `<tool></tool>` entry: Add a new `<tool></tool>` entry:
@ -150,4 +150,4 @@ Happy debugging!
- [Change](https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs) in IntelliJ configuration directory location - [Change](https://intellij-support.jetbrains.com/hc/en-us/articles/206544519-Directories-used-by-the-IDE-to-store-settings-caches-plugins-and-logs) in IntelliJ configuration directory location
<!-- END_IGNORE --> <!-- END_IGNORE -->

View File

@ -102,19 +102,22 @@ The `batch-sdk` service uses the PostgreSQL output binding defined in the [`bind
```python ```python
with DaprClient() as d: with DaprClient() as d:
sqlCmd = ('insert into orders (orderid, customer, price) values ' + sqlCmd = ('insert into orders (orderid, customer, price) values ' +
'(%s, \'%s\', %s)' % (order_line['orderid'], '(%s, \'%s\', %s)' % (order_line['orderid'],
order_line['customer'], order_line['customer'],
order_line['price'])) order_line['price']))
payload = {'sql': sqlCmd} payload = {'sql': sqlCmd}
print(sqlCmd, flush=True) print(sqlCmd, flush=True)
try: try:
# Insert order using Dapr output binding via HTTP Post # Insert order using Dapr output binding via HTTP Post
resp = d.invoke_binding(binding_name=sql_binding, operation='exec', resp = d.invoke_binding(binding_name=sql_binding, operation='exec',
binding_metadata=payload, data='') binding_metadata=payload, data='')
return resp return resp
except Exception as e:
print(e, flush=True)
raise SystemExit(e)
``` ```
### Step 4: View the output of the job ### Step 4: View the output of the job
@ -899,20 +902,20 @@ cd quickstarts/bindings/go/sdk/batch
Install the dependencies: Install the dependencies:
```bash ```bash
go build go build .
``` ```
Run the `batch-sdk` service alongside a Dapr sidecar. Run the `batch-sdk` service alongside a Dapr sidecar.
```bash ```bash
dapr run --app-id batch-sdk --app-port 6002 --dapr-http-port 3502 --dapr-grpc-port 60002 --components-path ../../../components -- go run dapr run --app-id batch-sdk --app-port 6002 --dapr-http-port 3502 --dapr-grpc-port 60002 --components-path ../../../components -- go run .
``` ```
The code inside the `process_batch` function is executed every 10 seconds (defined in [`binding-cron.yaml`]({{< ref "#componentsbinding-cronyaml-component-file" >}}) in the `components` directory). The binding trigger looks for a route called via HTTP POST in your Flask application by the Dapr sidecar. The code inside the `process_batch` function is executed every 10 seconds (defined in [`binding-cron.yaml`]({{< ref "#componentsbinding-cronyaml-component-file" >}}) in the `components` directory). The binding trigger looks for a route called via HTTP POST in your Flask application by the Dapr sidecar.
```go ```go
// Triggered by Dapr input binding // Triggered by Dapr input binding
r.HandleFunc("/"+cronBindingName, processBatch).Methods("POST") r.HandleFunc("/"+cronBindingName, processBatch).Methods("POST")
``` ```
The `batch-sdk` service uses the PostgreSQL output binding defined in the [`binding-postgres.yaml`]({{< ref "#componentbinding-postgresyaml-component-file" >}}) component to insert the `OrderId`, `Customer`, and `Price` records into the `orders` table. The `batch-sdk` service uses the PostgreSQL output binding defined in the [`binding-postgres.yaml`]({{< ref "#componentbinding-postgresyaml-component-file" >}}) component to insert the `OrderId`, `Customer`, and `Price` records into the `orders` table.

View File

@ -276,7 +276,7 @@ In the `checkout` publisher service, we're publishing the orderId message to the
const client = new DaprClient(DAPR_HOST, DAPR_HTTP_PORT); const client = new DaprClient(DAPR_HOST, DAPR_HTTP_PORT);
await client.pubsub.publish(PUBSUB_NAME, PUBSUB_TOPIC, order); await client.pubsub.publish(PUBSUB_NAME, PUBSUB_TOPIC, order);
console.log("Published data: " + JSON.stringify(order)); console.log("Published data: " + JSON.stringify(order));
``` ```
### Step 5: View the Pub/sub outputs ### Step 5: View the Pub/sub outputs
@ -700,13 +700,13 @@ cd pub_sub/go/sdk/order-processor
Install the dependencies and build the application: Install the dependencies and build the application:
```bash ```bash
go build go build .
``` ```
Run the `order-processor` subscriber service alongside a Dapr sidecar. Run the `order-processor` subscriber service alongside a Dapr sidecar.
```bash ```bash
dapr run --app-port 6001 --app-id order-processor --app-protocol http --dapr-http-port 3501 --components-path ../../../components -- go run dapr run --app-port 6002 --app-id order-processor-sdk --app-protocol http --dapr-http-port 3501 --components-path ../../../components -- go run .
``` ```
In the `order-processor` subscriber, we're subscribing to the Redis instance called `orderpubsub` [(as defined in the `pubsub.yaml` component)]({{< ref "#pubsubyaml-component-file" >}}) and topic `orders`. This enables your app code to talk to the Redis component instance through the Dapr sidecar. In the `order-processor` subscriber, we're subscribing to the Redis instance called `orderpubsub` [(as defined in the `pubsub.yaml` component)]({{< ref "#pubsubyaml-component-file" >}}) and topic `orders`. This enables your app code to talk to the Redis component instance through the Dapr sidecar.
@ -730,13 +730,13 @@ cd pub_sub/go/sdk/checkout
Install the dependencies and build the application: Install the dependencies and build the application:
```bash ```bash
go build app.go go build .
``` ```
Run the `checkout` publisher service alongside a Dapr sidecar. Run the `checkout` publisher service alongside a Dapr sidecar.
```bash ```bash
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 --components-path ../../../components -- go run app.go dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 --components-path ../../../components -- go run .
``` ```
In the `checkout` publisher, we're publishing the orderId message to the Redis instance called `orderpubsub` [(as defined in the `pubsub.yaml` component)]({{< ref "#pubsubyaml-component-file" >}}) and topic `orders`. As soon as the service starts, it publishes in a loop: In the `checkout` publisher, we're publishing the orderId message to the Redis instance called `orderpubsub` [(as defined in the `pubsub.yaml` component)]({{< ref "#pubsubyaml-component-file" >}}) and topic `orders`. As soon as the service starts, it publishes in a loop:
@ -748,7 +748,7 @@ if err := client.PublishEvent(ctx, PUBSUB_NAME, PUBSUB_TOPIC, []byte(order)); er
panic(err) panic(err)
} }
fmt.Sprintf("Published data: ", order) fmt.Println("Published data: ", order)
``` ```
### Step 5: View the Pub/sub outputs ### Step 5: View the Pub/sub outputs

View File

@ -75,8 +75,8 @@ Notice how the `order-processor` service below points to:
DAPR_SECRET_STORE = 'localsecretstore' DAPR_SECRET_STORE = 'localsecretstore'
SECRET_NAME = 'secret' SECRET_NAME = 'secret'
with DaprClient() as client: with DaprClient() as client:
secret = client.get_secret(store_name=DAPR_SECRET_STORE, key=SECRET_NAME) secret = client.get_secret(store_name=DAPR_SECRET_STORE, key=SECRET_NAME)
logging.info('Fetched Secret: %s', secret.secret) logging.info('Fetched Secret: %s', secret.secret)
``` ```
**`local-secret-store.yaml` component** **`local-secret-store.yaml` component**
@ -488,13 +488,13 @@ cd secrets_management/go/sdk/order-processor
Install the dependencies: Install the dependencies:
```bash ```bash
go build go build .
``` ```
Run the `order-processor` service alongside a Dapr sidecar. Run the `order-processor` service alongside a Dapr sidecar.
```bash ```bash
dapr run --app-id order-processor --components-path ../../../components/ -- go run dapr run --app-id order-processor --components-path ../../../components/ -- go run .
``` ```
#### Behind the scenes #### Behind the scenes
@ -508,12 +508,12 @@ Notice how the `order-processor` service below points to:
```go ```go
const DAPR_SECRET_STORE = "localsecretstore" const DAPR_SECRET_STORE = "localsecretstore"
const SECRET_NAME = "secret" const SECRET_NAME = "secret"
// ... // ...
secret, err := client.GetSecret(ctx, DAPR_SECRET_STORE, SECRET_NAME, nil) secret, err := client.GetSecret(ctx, DAPR_SECRET_STORE, SECRET_NAME, nil)
if secret != nil { if secret != nil {
fmt.Println("Fetched Secret: ", secret[SECRET_NAME]) fmt.Println("Fetched Secret: ", secret[SECRET_NAME])
} }
``` ```
**`local-secret-store.yaml` component** **`local-secret-store.yaml` component**

View File

@ -56,7 +56,7 @@ pip3 install -r requirements.txt
Run the `order-processor` service alongside a Dapr sidecar. Run the `order-processor` service alongside a Dapr sidecar.
```bash ```bash
dapr run --app-port 7001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- python3 app.py dapr run --app-port 8001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- python3 app.py
``` ```
> **Note**: Since Python3.exe is not defined in Windows, you may need to use `python app.py` instead of `python3 app.py`. > **Note**: Since Python3.exe is not defined in Windows, you may need to use `python app.py` instead of `python3 app.py`.
@ -70,7 +70,7 @@ def getOrder():
'ContentType': 'application/json'} 'ContentType': 'application/json'}
app.run(port=7001) app.run(port=8001)
``` ```
### Step 4: Run `checkout` service ### Step 4: Run `checkout` service
@ -221,8 +221,8 @@ let axiosConfig = {
"dapr-app-id": "order-processor" "dapr-app-id": "order-processor"
} }
}; };
const res = await axios.post(`${DAPR_HOST}:${DAPR_HTTP_PORT}/orders`, order , axiosConfig); const res = await axios.post(`${DAPR_HOST}:${DAPR_HTTP_PORT}/orders`, order , axiosConfig);
console.log("Order passed: " + res.config.data); console.log("Order passed: " + res.config.data);
``` ```
### Step 5: View the Service Invocation outputs ### Step 5: View the Service Invocation outputs
@ -535,13 +535,13 @@ cd service_invocation/go/http/order-processor
Install the dependencies: Install the dependencies:
```bash ```bash
go build go build .
``` ```
Run the `order-processor` service alongside a Dapr sidecar. Run the `order-processor` service alongside a Dapr sidecar.
```bash ```bash
dapr run --app-port 6001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- go run dapr run --app-port 6001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- go run .
``` ```
Each order is received via an HTTP POST request and processed by the Each order is received via an HTTP POST request and processed by the
@ -554,6 +554,7 @@ func getOrder(w http.ResponseWriter, r *http.Request) {
log.Fatal(err) log.Fatal(err)
} }
log.Printf("Order received : %s", string(data)) log.Printf("Order received : %s", string(data))
}
``` ```
### Step 4: Run `checkout` service ### Step 4: Run `checkout` service
@ -568,13 +569,13 @@ cd service_invocation/go/http/checkout
Install the dependencies: Install the dependencies:
```bash ```bash
go build app.go go build .
``` ```
Run the `checkout` service alongside a Dapr sidecar. Run the `checkout` service alongside a Dapr sidecar.
```bash ```bash
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- go run app.go dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- go run .
``` ```
In the `checkout` service, you'll notice there's no need to rewrite your app code to use Dapr's service invocation. You can enable service invocation by simply adding the `dapr-app-id` header, which specifies the ID of the target service. In the `checkout` service, you'll notice there's no need to rewrite your app code to use Dapr's service invocation. You can enable service invocation by simply adding the `dapr-app-id` header, which specifies the ID of the target service.

View File

@ -532,13 +532,13 @@ cd state_management/go/sdk/order-processor
Install the dependencies and build the application: Install the dependencies and build the application:
```bash ```bash
go build go build .
``` ```
Run the `order-processor` service alongside a Dapr sidecar. Run the `order-processor` service alongside a Dapr sidecar.
```bash ```bash
dapr run --app-id order-processor --components-path ../../../components -- go run dapr run --app-id order-processor --components-path ../../../components -- go run .
``` ```
The `order-processor` service writes, reads, and deletes an `orderId` key/value pair to the `statestore` instance [defined in the `statestore.yaml` component]({{< ref "#statestoreyaml-component-file" >}}). As soon as the service starts, it performs a loop. The `order-processor` service writes, reads, and deletes an `orderId` key/value pair to the `statestore` instance [defined in the `statestore.yaml` component]({{< ref "#statestoreyaml-component-file" >}}). As soon as the service starts, it performs a loop.