Updating Readme's to default to `dapr run -f .` (#874)

* Updating Invoke readme in C# to favor dapr run -f

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>

* Adding back single app run steps and tests, but to the end.

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Update service_invocation/csharp/http/README.md

Co-authored-by: Mark Fussell <markfussell@gmail.com>
Signed-off-by: Paul Yuknewicz <paulyuk@microsoft.com>

* Updated and hardened test

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Invoke * and partial PubSub with multi-run files & readmes & tests

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Multi run done for Pubsub C#, Python and Node (http, sdk)

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>

* Added Pubsub support for Go, Java

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>

* updating readmes with correct appid

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>

* Updating tests for PubSub and Service invoke to Paas with multiapp run

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* More fine tuning of pubsub tests (timeouts, step ends)

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

* Fixing Python FastAPI and C# Pubsub tests

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>

---------

Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>
Signed-off-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>
Signed-off-by: Paul Yuknewicz <paulyuk@microsoft.com>
Co-authored-by: Paul Yuknewicz <paulyuk@Pauls-MacBook-Pro-2.local>
Co-authored-by: Paul Yuknewicz <paulyuk@Pauls-MBP-2.lan>
Co-authored-by: Mark Fussell <markfussell@gmail.com>
This commit is contained in:
Paul Yuknewicz 2023-09-22 10:02:07 -07:00 committed by GitHub
parent e278ba420f
commit dcd97eeeeb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
29 changed files with 1469 additions and 888 deletions

View File

@ -14,78 +14,87 @@ And one subscriber:
- Dotnet subscriber `order-processor`
### Run Dotnet message subscriber with Dapr
## Run all apps with multi-app run template file:
1. Navigate to the directory and install dependencies:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Open a new terminal window and run `order-processor` and `checkout` using the multi app run template defined in [dapr.yaml](./dapr.yaml):
<!-- STEP
name: Install Dotnet dependencies
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor-http"'
- 'Started Dapr with app id "checkout-http"'
- '== APP - checkout-http == Published data: Order { OrderId = 10 }'
- '== APP - order-processor-http == Subscriber received : 10'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 45
-->
```bash
dapr run -f .
```
The terminal console output should look similar to this:
```text
== APP - checkout-http == Published data: Order { OrderId = 1 }
== APP - order-processor-http == Subscriber received : 1
== APP - checkout-http == Published data: Order { OrderId = 2 }
== APP - order-processor-http == Subscriber received : 2
== APP - checkout-http == Published data: Order { OrderId = 3 }
== APP - order-processor-http == Subscriber received : 3
== APP - checkout-http == Published data: Order { OrderId = 4 }
== APP - order-processor-http == Subscriber received : 4
== APP - checkout-http == Published data: Order { OrderId = 5 }
== APP - order-processor-http == Subscriber received : 5
== APP - checkout-http == Published data: Order { OrderId = 6 }
== APP - order-processor-http == Subscriber received : 6
== APP - checkout-http == Published data: Order { OrderId = 7 }
== APP - order-processor-http == Subscriber received : 7
== APP - checkout-http == Published data: Order { OrderId = 8 }
== APP - order-processor-http == Subscriber received : 8
== APP - checkout-http == Published data: Order { OrderId = 9 }
== APP - order-processor-http == Subscriber received : 9
== APP - checkout-http == Published data: Order { OrderId = 10 }
== APP - order-processor-http == Subscriber received : 10
```
2. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- dotnet run` commands. This next section covers how to do this.
### Run Dotnet message subscriber with Dapr
1. Run the Dotnet subscriber app with Dapr:
```bash
cd ./order-processor
dotnet restore
dotnet build
```
<!-- END_STEP -->
2. Run the Dotnet subscriber app with Dapr:
<!-- STEP
name: Run Dotnet subscriber
expected_stdout_lines:
- "You're up and running! Both Dapr and your app logs will appear here."
- '== APP == Subscriber received : 2'
- "Exited Dapr successfully"
- "Exited App successfully"
expected_stderr_lines:
working_dir: ./order-processor
output_match_mode: substring
background: true
sleep: 10
-->
```bash
dapr run --app-id order-processor-http --resources-path ../../../components/ --app-port 7005 -- dotnet run --project .
dapr run --app-id order-processor-http --resources-path ../../../components/ --app-port 7005 -- dotnet run
```
<!-- END_STEP -->
### Run Dotnet message publisher with Dapr
1. Navigate to the directory and install dependencies:
<!-- STEP
name: Install Dotnet dependencies
-->
1. Run the Dotnet publisher app with Dapr:
```bash
cd ./checkout
dotnet restore
dotnet build
```
<!-- END_STEP -->
2. Run the Dotnet publisher app with Dapr:
<!-- STEP
name: Run Dotnet publisher
expected_stdout_lines:
- "You're up and running! Both Dapr and your app logs will appear here."
- '== APP == Published data: Order { OrderId = 1 }'
- '== APP == Published data: Order { OrderId = 2 }'
- "Exited App successfully"
- "Exited Dapr successfully"
expected_stderr_lines:
working_dir: ./checkout
output_match_mode: substring
background: true
sleep: 10
-->
```bash
dapr run --app-id checkout-http --resources-path ../../../components/ -- dotnet run --project .
dapr run --app-id checkout-http --resources-path ../../../components/ -- dotnet run
```
<!-- END_STEP -->
2. Stop and clean up application processes
```bash
dapr stop --app-id order-processor-http

View File

@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor-http
appDirPath: ./order-processor/
appPort: 7005
command: ["dotnet", "run"]
- appID: checkout-http
appDirPath: ./checkout/
command: ["dotnet", "run"]

View File

@ -14,78 +14,87 @@ And one subscriber:
- Dotnet subscriber `order-processor`
### Run Dotnet message subscriber with Dapr
## Run all apps with multi-app run template file:
1. Navigate to the directory and install dependencies:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Open a new terminal window and run the multi app run template:
<!-- STEP
name: Install Dotnet dependencies
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor"'
- 'Started Dapr with app id "checkout-sdk"'
- 'Published data: Order { OrderId = 10 }'
- 'Subscriber received : Order { OrderId = 10 }'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 60
-->
```bash
dapr run -f .
```
The terminal console output should look similar to this:
```text
== APP - checkout-sdk == Published data: Order { OrderId = 1 }
== APP - order-processor == Subscriber received : Order { OrderId = 1 }
== APP - checkout-sdk == Published data: Order { OrderId = 2 }
== APP - order-processor == Subscriber received : Order { OrderId = 2 }
== APP - checkout-sdk == Published data: Order { OrderId = 3 }
== APP - order-processor == Subscriber received : Order { OrderId = 3 }
== APP - checkout-sdk == Published data: Order { OrderId = 4 }
== APP - order-processor == Subscriber received : Order { OrderId = 4 }
== APP - checkout-sdk == Published data: Order { OrderId = 5 }
== APP - order-processor == Subscriber received : Order { OrderId = 5 }
== APP - checkout-sdk == Published data: Order { OrderId = 6 }
== APP - order-processor == Subscriber received : Order { OrderId = 6 }
== APP - checkout-sdk == Published data: Order { OrderId = 7 }
== APP - order-processor == Subscriber received : Order { OrderId = 7 }
== APP - checkout-sdk == Published data: Order { OrderId = 8 }
== APP - order-processor == Subscriber received : Order { OrderId = 8 }
== APP - checkout-sdk == Published data: Order { OrderId = 9 }
== APP - order-processor == Subscriber received : Order { OrderId = 9 }
== APP - checkout-sdk == Published data: Order { OrderId = 10 }
== APP - order-processor == Subscriber received : Order { OrderId = 10 }
```
2. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- dotnet run` commands. This next section covers how to do this.
### Run Dotnet message subscriber with Dapr
1. Run the Dotnet subscriber app with Dapr:
```bash
cd ./order-processor
dotnet restore
dotnet build
```
<!-- END_STEP -->
2. Run the Dotnet subscriber app with Dapr:
<!-- STEP
name: Run Dotnet subscriber
expected_stdout_lines:
- "You're up and running! Both Dapr and your app logs will appear here."
- '== APP == Subscriber received : Order { OrderId = 2 }'
- "Exited Dapr successfully"
- "Exited App successfully"
expected_stderr_lines:
working_dir: ./order-processor
output_match_mode: substring
background: true
sleep: 10
-->
```bash
dapr run --app-id order-processor --resources-path ../../../components/ --app-port 7006 -- dotnet run --project .
dapr run --app-id order-processor --resources-path ../../../components/ --app-port 7006 -- dotnet run
```
<!-- END_STEP -->
### Run Dotnet message publisher with Dapr
1. Navigate to the directory and install dependencies:
<!-- STEP
name: Install Dotnet dependencies
-->
1. Run the Dotnet publisher app with Dapr:
```bash
cd ./checkout
dotnet restore
dotnet build
```
<!-- END_STEP -->
2. Run the Dotnet publisher app with Dapr:
<!-- STEP
name: Run Dotnet publisher
expected_stdout_lines:
- "You're up and running! Both Dapr and your app logs will appear here."
- '== APP == Published data: Order { OrderId = 1 }'
- '== APP == Published data: Order { OrderId = 2 }'
- "Exited App successfully"
- "Exited Dapr successfully"
expected_stderr_lines:
working_dir: ./checkout
output_match_mode: substring
background: true
sleep: 10
-->
```bash
dapr run --app-id checkout-sdk --resources-path ../../../components/ -- dotnet run --project .
dapr run --app-id checkout-sdk --resources-path ../../../components/ -- dotnet run
```
<!-- END_STEP -->
2. Stop and clean up application processes
```bash
dapr stop --app-id order-processor

View File

@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor
appDirPath: ./order-processor/
appPort: 7006
command: ["dotnet", "run"]
- appID: checkout-sdk
appDirPath: ./checkout/
command: ["dotnet", "run"]

View File

@ -10,51 +10,85 @@ This quickstart includes one publisher: Go client message generator `checkout`.
And one subscriber: Go subscriber `order-processor`.
## Run all apps with multi-app run template file:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Open a new terminal window and run the multi app run template:
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor-http"'
- 'Started Dapr with app id "checkout-http"'
- '== APP - checkout-http == Published data: {"orderId":10}'
- '== APP - order-processor-http == Subscriber received: {"orderId":10}'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
The terminal console output should look similar to this:
```text
== APP - checkout-http == Published data: {"orderId":1}
== APP - order-processor-http == Subscriber received: {"orderId":1}
== APP - checkout-http == Published data: {"orderId":2}
== APP - order-processor-http == Subscriber received: {"orderId":2}
== APP - checkout-http == Published data: {"orderId":3}
== APP - order-processor-http == Subscriber received: {"orderId":3}
== APP - checkout-http == Published data: {"orderId":4}
== APP - order-processor-http == Subscriber received: {"orderId":4}
== APP - checkout-http == Published data: {"orderId":5}
== APP - order-processor-http == Subscriber received: {"orderId":5}
== APP - checkout-http == Published data: {"orderId":6}
== APP - order-processor-http == Subscriber received: {"orderId":6}
== APP - checkout-http == Published data: {"orderId":7}
== APP - order-processor-http == Subscriber received: {"orderId":7}
== APP - checkout-http == Published data: {"orderId":8}
== APP - order-processor-http == Subscriber received: {"orderId":8}
== APP - checkout-http == Published data: {"orderId":9}
== APP - order-processor-http == Subscriber received: {"orderId":9}
== APP - checkout-http == Published data: {"orderId":10}
== APP - order-processor-http == Subscriber received: {"orderId":10}
```
2. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- dotnet run` commands. This next section covers how to do this.
### Run Go message subscriber with Dapr
1. Run the Go subscriber app with Dapr in the `order-processor` folder:
<!-- STEP
name: Run Go subscriber
expected_stdout_lines:
- '== APP == Subscriber received: {"orderId":10}'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
cd ./order-processor
dapr run --app-port 6002 --app-id order-processor --app-protocol http --dapr-http-port 3501 --resources-path ../../../components -- go run .
dapr run --app-port 6003 --app-id order-processor-http --app-protocol http --dapr-http-port 3501 --resources-path ../../../components -- go run .
```
<!-- END_STEP -->
### Run Go message publisher with Dapr
1. Run the Go publisher app with Dapr in the `checkout` folder:
<!-- STEP
name: Run Go publisher
expected_stdout_lines:
- '== APP == Published data: {"orderId":1}'
- '== APP == Published data: {"orderId":2}'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
cd ./checkout
dapr run --app-id checkout-http --app-protocol http --dapr-http-port 3500 --resources-path ../../../components -- go run .
```
<!-- END_STEP -->
To stop:
```bash

11
pub_sub/go/http/dapr.yaml Normal file
View File

@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor-http
appDirPath: ./order-processor/
appPort: 6003
command: ["go", "run", "."]
- appID: checkout-http
appDirPath: ./checkout/
command: ["go", "run", "."]

View File

@ -10,51 +10,86 @@ This quickstart includes one publisher: Go client message generator `checkout`
And one subscriber: Go subscriber `order-processor`
## Run all apps with multi-app run template file:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Open a new terminal window and run the multi app run template:
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor"'
- 'Started Dapr with app id "checkout-sdk"'
- '== APP - checkout-sdk == Published data: {"orderId":1}'
- '== APP - order-processor == Subscriber received: map[orderId:1]'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
The terminal console output should look similar to this:
```text
== APP - checkout-sdk == Published data: {"orderId":1}
== APP - order-processor == Subscriber received: map[orderId:1]
== APP - checkout-sdk == Published data: {"orderId":2}
== APP - order-processor == Subscriber received: map[orderId:2]
== APP - checkout-sdk == Published data: {"orderId":3}
== APP - order-processor == Subscriber received: map[orderId:3]
== APP - checkout-sdk == Published data: {"orderId":4}
== APP - order-processor == Subscriber received: map[orderId:4]
== APP - checkout-sdk == Published data: {"orderId":5}
== APP - order-processor == Subscriber received: map[orderId:5]
== APP - checkout-sdk == Published data: {"orderId":6}
== APP - order-processor == Subscriber received: map[orderId:6]
== APP - checkout-sdk == Published data: {"orderId":7}
== APP - order-processor == Subscriber received: map[orderId:7]
== APP - checkout-sdk == Published data: {"orderId":8}
== APP - order-processor == Subscriber received: map[orderId:8]
== APP - checkout-sdk == Published data: {"orderId":9}
== APP - order-processor == Subscriber received: map[orderId:9]
== APP - checkout-sdk == Published data: {"orderId":10}
== APP - order-processor == Subscriber received: map[orderId:10]
```
2. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- dotnet run` commands. This next section covers how to do this.
### Run Go message subscriber with Dapr
1. Run the Go subscriber app with Dapr in the `order-processor` folder:
<!-- STEP
name: Run Go subscriber
expected_stdout_lines:
- '== APP == Subscriber received: map[orderId:10]'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
cd ./order-processor
dapr run --app-port 6005 --app-id order-processor-sdk --app-protocol http --dapr-http-port 3501 --resources-path ../../../components -- go run .
```
<!-- END_STEP -->
### Run Go message publisher with Dapr
1 Run the Go publisher app with Dapr in the `checkout` folder:
<!-- STEP
name: Run Go publisher
expected_stdout_lines:
- '== APP == Published data: {"orderId":1}'
- '== APP == Published data: {"orderId":2}'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
cd ./checkout
dapr run --app-id checkout-sdk --app-protocol http --dapr-http-port 3500 --resources-path ../../../components -- go run .
```
<!-- END_STEP -->
To stop:
```bash

11
pub_sub/go/sdk/dapr.yaml Normal file
View File

@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor
appDirPath: ./order-processor/
appPort: 6005
command: ["go", "run", "."]
- appID: checkout-sdk
appDirPath: ./checkout/
command: ["go", "run", "."]

View File

@ -23,69 +23,113 @@ And one subscriber:
* [OpenJDK 11](https://jdk.java.net/11/)
* [Apache Maven](https://maven.apache.org/install.html) version 3.x.
## Run all apps with multi-app run template file:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Install dependencies:
<!-- STEP
name: Install Node dependencies
-->
```bash
cd ./order-processor
mvn clean install
cd ..
cd ./checkout
mvn clean install
cd ..
```
<!-- END_STEP -->
2. Open a new terminal window and run the multi app run template:
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor-http"'
- 'Started Dapr with app id "checkout-http"'
- 'Published data: 10'
- 'Subscriber received: 10'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
The terminal console output should look similar to this:
```text
== APP - order-processor-http == 2023-09-04 14:25:37.624 INFO 88784 --- [nio-8080-exec-1] c.s.c.OrderProcessingServiceController : Subscriber received: 1
== APP - checkout-http == 1175 [main] INFO com.service.CheckoutServiceApplication - Published data: 2
== APP - order-processor-http == 2023-09-04 14:25:38.558 INFO 88784 --- [nio-8080-exec-2] c.s.c.OrderProcessingServiceController : Subscriber received: 2
== APP - checkout-http == 2184 [main] INFO com.service.CheckoutServiceApplication - Published data: 3
== APP - order-processor-http == 2023-09-04 14:25:39.567 INFO 88784 --- [nio-8080-exec-3] c.s.c.OrderProcessingServiceController : Subscriber received: 3
== APP - checkout-http == 3195 [main] INFO com.service.CheckoutServiceApplication - Published data: 4
== APP - order-processor-http == 2023-09-04 14:25:40.578 INFO 88784 --- [nio-8080-exec-4] c.s.c.OrderProcessingServiceController : Subscriber received: 4
== APP - checkout-http == 4203 [main] INFO com.service.CheckoutServiceApplication - Published data: 5
== APP - order-processor-http == 2023-09-04 14:25:41.586 INFO 88784 --- [nio-8080-exec-5] c.s.c.OrderProcessingServiceController : Subscriber received: 5
== APP - checkout-http == 5215 [main] INFO com.service.CheckoutServiceApplication - Published data: 6
== APP - order-processor-http == 2023-09-04 14:25:42.600 INFO 88784 --- [nio-8080-exec-6] c.s.c.OrderProcessingServiceController : Subscriber received: 6
== APP - checkout-http == 6219 [main] INFO com.service.CheckoutServiceApplication - Published data: 7
== APP - order-processor-http == 2023-09-04 14:25:43.601 INFO 88784 --- [nio-8080-exec-7] c.s.c.OrderProcessingServiceController : Subscriber received: 7
== APP - checkout-http == 7224 [main] INFO com.service.CheckoutServiceApplication - Published data: 8
== APP - order-processor-http == 2023-09-04 14:25:44.607 INFO 88784 --- [nio-8080-exec-8] c.s.c.OrderProcessingServiceController : Subscriber received: 8
== APP - checkout-http == 8229 [main] INFO com.service.CheckoutServiceApplication - Published data: 9
== APP - order-processor-http == 2023-09-04 14:25:45.612 INFO 88784 --- [nio-8080-exec-9] c.s.c.OrderProcessingServiceController : Subscriber received: 9
== APP - checkout-http == 9237 [main] INFO com.service.CheckoutServiceApplication - Published data: 10
== APP - order-processor-http == 2023-09-04 14:25:46.620 INFO 88784 --- [io-8080-exec-10] c.s.c.OrderProcessingServiceController : Subscriber received: 10
```
3. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- dotnet run` commands. This next section covers how to do this.
### Run Java message subscriber app with Dapr
1. Navigate to directory and install dependencies:
<!-- STEP
name: Install Java dependencies
-->
```bash
cd ./order-processor
mvn clean install
```
<!-- END_STEP -->
2. Run the Java subscriber app with Dapr:
<!-- STEP
name: Run Java publisher
expected_stdout_lines:
- 'Subscriber received: 2'
- "Exited App successfully"
expected_stderr_lines:
working_dir: ./order-processor
output_match_mode: substring
background: true
sleep: 10
-->
```bash
cd ./order-processor
dapr run --app-port 8080 --app-id order-processor-http --resources-path ../../../components -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar
```
<!-- END_STEP -->
### Run Java message publisher app with Dapr
1. Navigate to the directory and install dependencies:
<!-- STEP
name: Install Java dependencies
-->
```bash
cd ./checkout
mvn clean install
```
<!-- END_STEP -->
2. Run the Java publisher app with Dapr:
<!-- STEP
name: Run Java publisher
expected_stdout_lines:
- 'Published data: 1'
- 'Published data: 2'
- "Exited App successfully"
expected_stderr_lines:
working_dir: ./checkout
output_match_mode: substring
background: true
sleep: 10
-->
```bash
cd ./checkout
dapr run --app-id checkout-http --resources-path ../../../components -- java -jar target/CheckoutService-0.0.1-SNAPSHOT.jar
```
<!-- END_STEP -->
```bash
dapr stop --app-id checkout-http

View File

@ -26,7 +26,7 @@ public class CheckoutServiceApplication {
public static void main(String[] args) throws InterruptedException, IOException {
String uri = DAPR_HOST + ":" + DAPR_HTTP_PORT + "/v1.0/publish/" + PUBSUB_NAME + "/" + TOPIC;
for (int i = 0; i <= 10; i++) {
for (int i = 1; i <= 10; i++) {
int orderId = i;
JSONObject obj = new JSONObject();
obj.put("orderId", orderId);
@ -40,7 +40,7 @@ public class CheckoutServiceApplication {
HttpResponse<String> response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());
logger.info("Published data: {}", orderId);
TimeUnit.MILLISECONDS.sleep(3000);
TimeUnit.MILLISECONDS.sleep(1000);
}
}
}

View File

@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor-http
appDirPath: ./order-processor/target/
appPort: 8080
command: ["java", "-jar", "OrderProcessingService-0.0.1-SNAPSHOT.jar"]
- appID: checkout-http
appDirPath: ./checkout/target/
command: ["java", "-jar", "CheckoutService-0.0.1-SNAPSHOT.jar"]

View File

@ -23,70 +23,113 @@ And one subscriber:
* [OpenJDK 11](https://jdk.java.net/11/)
* [Apache Maven](https://maven.apache.org/install.html) version 3.x.
## Run all apps with multi-app run template file:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Install dependencies:
<!-- STEP
name: Install Node dependencies
-->
```bash
cd ./order-processor
mvn clean install
cd ..
cd ./checkout
mvn clean install
cd ..
```
<!-- END_STEP -->
2. Open a new terminal window and run the multi app run template:
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor-sdk"'
- 'Started Dapr with app id "checkout-sdk"'
- 'Published data: 10'
- 'Subscriber received: 10'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
The terminal console output should look similar to this:
```text
== APP - checkout-sdk == 563 [main] INFO com.service.CheckoutServiceApplication - Published data: 1
== APP - order-processor-sdk == 2023-09-04 13:57:18.434 INFO 82828 --- [nio-8080-exec-3] c.s.c.OrderProcessingServiceController : Subscriber received: 1
== APP - checkout-sdk == 1576 [main] INFO com.service.CheckoutServiceApplication - Published data: 2
== APP - order-processor-sdk == 2023-09-04 13:57:19.419 INFO 82828 --- [nio-8080-exec-4] c.s.c.OrderProcessingServiceController : Subscriber received: 2
== APP - checkout-sdk == 2587 [main] INFO com.service.CheckoutServiceApplication - Published data: 3
== APP - order-processor-sdk == 2023-09-04 13:57:20.431 INFO 82828 --- [nio-8080-exec-5] c.s.c.OrderProcessingServiceController : Subscriber received: 3
== APP - checkout-sdk == 3602 [main] INFO com.service.CheckoutServiceApplication - Published data: 4
== APP - order-processor-sdk == 2023-09-04 13:57:21.447 INFO 82828 --- [nio-8080-exec-6] c.s.c.OrderProcessingServiceController : Subscriber received: 4
== APP - checkout-sdk == 4612 [main] INFO com.service.CheckoutServiceApplication - Published data: 5
== APP - order-processor-sdk == 2023-09-04 13:57:22.455 INFO 82828 --- [nio-8080-exec-7] c.s.c.OrderProcessingServiceController : Subscriber received: 5
== APP - checkout-sdk == 5624 [main] INFO com.service.CheckoutServiceApplication - Published data: 6
== APP - order-processor-sdk == 2023-09-04 13:57:23.468 INFO 82828 --- [nio-8080-exec-8] c.s.c.OrderProcessingServiceController : Subscriber received: 6
== APP - checkout-sdk == 6631 [main] INFO com.service.CheckoutServiceApplication - Published data: 7
== APP - order-processor-sdk == 2023-09-04 13:57:24.474 INFO 82828 --- [nio-8080-exec-9] c.s.c.OrderProcessingServiceController : Subscriber received: 7
== APP - checkout-sdk == 7643 [main] INFO com.service.CheckoutServiceApplication - Published data: 8
== APP - order-processor-sdk == 2023-09-04 13:57:25.487 INFO 82828 --- [io-8080-exec-10] c.s.c.OrderProcessingServiceController : Subscriber received: 8
== APP - checkout-sdk == 8649 [main] INFO com.service.CheckoutServiceApplication - Published data: 9
== APP - order-processor-sdk == 2023-09-04 13:57:26.492 INFO 82828 --- [nio-8080-exec-2] c.s.c.OrderProcessingServiceController : Subscriber received: 9
== APP - checkout-sdk == 9662 [main] INFO com.service.CheckoutServiceApplication - Published data: 10
== APP - order-processor-sdk == 2023-09-04 13:57:27.504 INFO 82828 --- [nio-8080-exec-1] c.s.c.OrderProcessingServiceController : Subscriber received: 10
```
3. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- dotnet run` commands. This next section covers how to do this.
### Run Java message subscriber app with Dapr
1. Navigate to directory and install dependencies:
<!-- STEP
name: Install Java dependencies
-->
```bash
cd ./order-processor
mvn clean install
```
<!-- END_STEP -->
2. Run the Java subscriber app with Dapr:
<!-- STEP
name: Run Java publisher
working_dir: ./order-processor
expected_stdout_lines:
- 'Subscriber received: 2'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 10
-->
```bash
cd ./order-processor
dapr run --app-port 8080 --app-id order-processor-sdk --resources-path ../../../components -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar
```
<!-- END_STEP -->
### Run Java message publisher app with Dapr
1. Navigate to the directory and install dependencies:
<!-- STEP
name: Install Java dependencies
-->
```bash
cd ./checkout
mvn clean install
```
<!-- END_STEP -->
2. Run the Java publisher app with Dapr:
<!-- STEP
name: Run Java publisher
working_dir: ./checkout
expected_stdout_lines:
- 'Published data: 1'
- 'Published data: 2'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 10
-->
```bash
cd ./checkout
dapr run --app-id checkout-sdk --resources-path ../../../components -- java -jar target/CheckoutService-0.0.1-SNAPSHOT.jar
```
<!-- END_STEP -->
```bash
dapr stop --app-id checkout-sdk

View File

@ -16,7 +16,7 @@ public class CheckoutServiceApplication {
String PUBSUB_NAME = "orderpubsub";
DaprClient client = new DaprClientBuilder().build();
for (int i = 0; i <= 10; i++) {
for (int i = 1; i <= 10; i++) {
int orderId = i;
Order order = new Order(orderId);
@ -26,7 +26,7 @@ public class CheckoutServiceApplication {
TOPIC_NAME,
order).block();
logger.info("Published data: " + order.getOrderId());
TimeUnit.MILLISECONDS.sleep(5000);
TimeUnit.MILLISECONDS.sleep(1000);
}
}
}

View File

@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor-sdk
appDirPath: ./order-processor/target/
appPort: 8080
command: ["java", "-jar", "OrderProcessingService-0.0.1-SNAPSHOT.jar"]
- appID: checkout-sdk
appDirPath: ./checkout/target/
command: ["java", "-jar", "CheckoutService-0.0.1-SNAPSHOT.jar"]

View File

@ -14,7 +14,9 @@ And one subscriber:
- Node subscriber `order-processor`
### Run Node message subscriber with Dapr
## Run all apps with multi-app run template file:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Install dependencies:
@ -25,61 +27,100 @@ name: Install Node dependencies
```bash
cd ./order-processor
npm install
cd ..
cd ./checkout
npm install
```
<!-- END_STEP -->
2. Run the Node publisher app with Dapr:
2. Open a new terminal window and run the multi app run template:
<!-- STEP
name: Run Node publisher
name: Run multi app run template
expected_stdout_lines:
- "You're up and running! Both Dapr and your app logs will appear here."
- "Exited App successfully"
- 'Started Dapr with app id "order-processor-http"'
- 'Started Dapr with app id "checkout-http"'
- '== APP - checkout-http == Published data: {"orderId":10}'
- '== APP - order-processor-http == Subscriber received: { orderId: 10 }'
expected_stderr_lines:
working_dir: ./order-processor
output_match_mode: substring
match_order: none
background: true
sleep: 10
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run --app-id order-processor-http --resources-path ../../../components/ --app-port 5003 -- node .
dapr run -f .
```
The terminal console output should look similar to this:
```text
== APP - checkout-sdk-http == Published data: {"orderId":1}
== APP - order-processor-http == Subscriber received: { orderId: 1 }
== APP - checkout-sdk-http == Published data: {"orderId":2}
== APP - order-processor-http == Subscriber received: { orderId: 2 }
== APP - checkout-sdk-http == Published data: {"orderId":3}
== APP - order-processor-http == Subscriber received: { orderId: 3 }
== APP - checkout-sdk-http == Published data: {"orderId":4}
== APP - order-processor-http == Subscriber received: { orderId: 4 }
== APP - checkout-sdk-http == Published data: {"orderId":5}
== APP - order-processor-http == Subscriber received: { orderId: 5 }
== APP - checkout-sdk-http == Published data: {"orderId":6}
== APP - order-processor-http == Subscriber received: { orderId: 6 }
== APP - checkout-sdk-http == Published data: {"orderId":7}
== APP - order-processor-http == Subscriber received: { orderId: 7 }
== APP - checkout-sdk-http == Published data: {"orderId":8}
== APP - order-processor-http == Subscriber received: { orderId: 8 }
== APP - checkout-sdk-http == Published data: {"orderId":9}
== APP - order-processor-http == Subscriber received: { orderId: 9 }
== APP - checkout-sdk-http == Published data: {"orderId":10}
== APP - order-processor-http == Subscriber received: { orderId: 10 }
```
3. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- npm run start` commands. This next section covers how to do this.
### Run Node message subscriber with Dapr
1. Install dependencies:
```bash
cd ./order-processor
npm install
```
2. Run the Node publisher app with Dapr:
```bash
dapr run --app-port 5003 --app-id order-processing-http --app-protocol http --dapr-http-port 3501 --resources-path ../../../components -- npm run start
```
### Run Node message publisher with Dapr
1. Install dependencies:
<!-- STEP
name: Install Node dependencies
-->
```bash
cd ./checkout
npm install
```
<!-- END_STEP -->
2. Run the Node publisher app with Dapr:
<!-- STEP
name: Run Node publisher
expected_stdout_lines:
- '== APP == Published data: {"orderId":2}'
- '== APP == Published data: {"orderId":3}'
- "Exited App successfully"
expected_stderr_lines:
working_dir: ./checkout
output_match_mode: substring
background: true
sleep: 10
-->
2. Run the Node publisher app with Dapr:
```bash
dapr run --app-id checkout-http --resources-path ../../../components/ --app-port 5003 -- node .
dapr run --app-id checkout-http --app-protocol http --dapr-http-port 3500 --resources-path ../../../components -- npm run start
```
<!-- END_STEP -->
### Stop the apps and clean up
```bash
dapr stop --app-id checkout-http

View File

@ -1,21 +1,43 @@
{
"name": "checkout",
"version": "1.0.0",
"lockfileVersion": 1,
"lockfileVersion": 3,
"requires": true,
"dependencies": {
"axios": {
"packages": {
"": {
"name": "checkout",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"axios": "^0.25.0"
}
},
"node_modules/axios": {
"version": "0.25.0",
"resolved": "https://registry.npmjs.org/axios/-/axios-0.25.0.tgz",
"integrity": "sha512-cD8FOb0tRH3uuEe6+evtAbgJtfxr7ly3fQjYcMcuPlgkwVS9xboaVIpcDV+cYQe+yGykgwZCs1pzjntcGa6l5g==",
"requires": {
"dependencies": {
"follow-redirects": "^1.14.7"
}
},
"follow-redirects": {
"node_modules/follow-redirects": {
"version": "1.14.7",
"resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ=="
"integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ==",
"funding": [
{
"type": "individual",
"url": "https://github.com/sponsors/RubenVerborgh"
}
],
"engines": {
"node": ">=4.0"
},
"peerDependenciesMeta": {
"debug": {
"optional": true
}
}
}
}
}

View File

@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor-http
appDirPath: ./order-processor/
appPort: 5003
command: ["npm", "run", "start"]
- appID: checkout-http
appDirPath: ./checkout/
command: ["npm", "run", "start"]

View File

@ -1,28 +1,39 @@
{
"name": "order-processor",
"version": "1.0.0",
"lockfileVersion": 1,
"lockfileVersion": 3,
"requires": true,
"dependencies": {
"accepts": {
"packages": {
"": {
"name": "order-processor",
"version": "1.0.0",
"license": "ISC",
"dependencies": {
"express": "^4.17.2"
}
},
"node_modules/accepts": {
"version": "1.3.8",
"resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.8.tgz",
"integrity": "sha512-PYAthTa2m2VKxuvSD3DPC/Gy+U+sOA1LAuT8mkmRuvw+NACSaeXEQ+NHcVF7rONl6qcaxV3Uuemwawk+7+SJLw==",
"requires": {
"dependencies": {
"mime-types": "~2.1.34",
"negotiator": "0.6.3"
},
"engines": {
"node": ">= 0.6"
}
},
"array-flatten": {
"node_modules/array-flatten": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/array-flatten/-/array-flatten-1.1.1.tgz",
"integrity": "sha1-ml9pkFGx5wczKPKgCJaLZOopVdI="
},
"body-parser": {
"node_modules/body-parser": {
"version": "1.19.1",
"resolved": "https://registry.npmjs.org/body-parser/-/body-parser-1.19.1.tgz",
"integrity": "sha512-8ljfQi5eBk8EJfECMrgqNGWPEY5jWP+1IzkzkGdFFEwFQZZyaZ21UqdaHktgiMlH0xLHqIFtE/u2OYE5dOtViA==",
"requires": {
"dependencies": {
"bytes": "3.1.1",
"content-type": "~1.0.4",
"debug": "2.6.9",
@ -33,79 +44,103 @@
"qs": "6.9.6",
"raw-body": "2.4.2",
"type-is": "~1.6.18"
},
"engines": {
"node": ">= 0.8"
}
},
"bytes": {
"node_modules/bytes": {
"version": "3.1.1",
"resolved": "https://registry.npmjs.org/bytes/-/bytes-3.1.1.tgz",
"integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg=="
"integrity": "sha512-dWe4nWO/ruEOY7HkUJ5gFt1DCFV9zPRoJr8pV0/ASQermOZjtq8jMjOprC0Kd10GLN+l7xaUPvxzJFWtxGu8Fg==",
"engines": {
"node": ">= 0.8"
}
},
"content-disposition": {
"node_modules/content-disposition": {
"version": "0.5.4",
"resolved": "https://registry.npmjs.org/content-disposition/-/content-disposition-0.5.4.tgz",
"integrity": "sha512-FveZTNuGw04cxlAiWbzi6zTAL/lhehaWbTtgluJh4/E95DqMwTmha3KZN1aAWA8cFIhHzMZUvLevkw5Rqk+tSQ==",
"requires": {
"dependencies": {
"safe-buffer": "5.2.1"
},
"engines": {
"node": ">= 0.6"
}
},
"content-type": {
"node_modules/content-type": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/content-type/-/content-type-1.0.4.tgz",
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA=="
"integrity": "sha512-hIP3EEPs8tB9AT1L+NUqtwOAps4mk2Zob89MWXMHjHWg9milF/j4osnnQLXBCBFBk/tvIG/tUc9mOUJiPBhPXA==",
"engines": {
"node": ">= 0.6"
}
},
"cookie": {
"node_modules/cookie": {
"version": "0.4.1",
"resolved": "https://registry.npmjs.org/cookie/-/cookie-0.4.1.tgz",
"integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA=="
"integrity": "sha512-ZwrFkGJxUR3EIoXtO+yVE69Eb7KlixbaeAWfBQB9vVsNn/o+Yw69gBWSSDK825hQNdN+wF8zELf3dFNl/kxkUA==",
"engines": {
"node": ">= 0.6"
}
},
"cookie-signature": {
"node_modules/cookie-signature": {
"version": "1.0.6",
"resolved": "https://registry.npmjs.org/cookie-signature/-/cookie-signature-1.0.6.tgz",
"integrity": "sha1-4wOogrNCzD7oylE6eZmXNNqzriw="
},
"debug": {
"node_modules/debug": {
"version": "2.6.9",
"resolved": "https://registry.npmjs.org/debug/-/debug-2.6.9.tgz",
"integrity": "sha512-bC7ElrdJaJnPbAP+1EotYvqZsb3ecl5wi6Bfi6BJTUcNowp6cvspg0jXznRTKDjm/E7AdgFBVeAPVMNcKGsHMA==",
"requires": {
"dependencies": {
"ms": "2.0.0"
}
},
"depd": {
"node_modules/depd": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz",
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak="
"integrity": "sha1-m81S4UwJd2PnSbJ0xDRu0uVgtak=",
"engines": {
"node": ">= 0.6"
}
},
"destroy": {
"node_modules/destroy": {
"version": "1.0.4",
"resolved": "https://registry.npmjs.org/destroy/-/destroy-1.0.4.tgz",
"integrity": "sha1-l4hXRCxEdJ5CBmE+N5RiBYJqvYA="
},
"ee-first": {
"node_modules/ee-first": {
"version": "1.1.1",
"resolved": "https://registry.npmjs.org/ee-first/-/ee-first-1.1.1.tgz",
"integrity": "sha1-WQxhFWsK4vTwJVcyoViyZrxWsh0="
},
"encodeurl": {
"node_modules/encodeurl": {
"version": "1.0.2",
"resolved": "https://registry.npmjs.org/encodeurl/-/encodeurl-1.0.2.tgz",
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k="
"integrity": "sha1-rT/0yG7C0CkyL1oCw6mmBslbP1k=",
"engines": {
"node": ">= 0.8"
}
},
"escape-html": {
"node_modules/escape-html": {
"version": "1.0.3",
"resolved": "https://registry.npmjs.org/escape-html/-/escape-html-1.0.3.tgz",
"integrity": "sha1-Aljq5NPQwJdN4cFpGI7wBR0dGYg="
},
"etag": {
"node_modules/etag": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/etag/-/etag-1.8.1.tgz",
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc="
"integrity": "sha1-Qa4u62XvpiJorr/qg6x9eSmbCIc=",
"engines": {
"node": ">= 0.6"
}
},
"express": {
"node_modules/express": {
"version": "4.17.2",
"resolved": "https://registry.npmjs.org/express/-/express-4.17.2.tgz",
"integrity": "sha512-oxlxJxcQlYwqPWKVJJtvQiwHgosH/LrLSPA+H4UxpyvSS6jC5aH+5MoHFM+KABgTOt0APue4w66Ha8jCUo9QGg==",
"requires": {
"dependencies": {
"accepts": "~1.3.7",
"array-flatten": "1.1.1",
"body-parser": "1.19.1",
@ -136,13 +171,16 @@
"type-is": "~1.6.18",
"utils-merge": "1.0.1",
"vary": "~1.1.2"
},
"engines": {
"node": ">= 0.10.0"
}
},
"finalhandler": {
"node_modules/finalhandler": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/finalhandler/-/finalhandler-1.1.2.tgz",
"integrity": "sha512-aAWcW57uxVNrQZqFXjITpW3sIUQmHGG3qSb9mUah9MgMC4NeWhNOlNjXEYq3HjRAvL6arUviZGGJsBg6z0zsWA==",
"requires": {
"dependencies": {
"debug": "2.6.9",
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
@ -150,154 +188,228 @@
"parseurl": "~1.3.3",
"statuses": "~1.5.0",
"unpipe": "~1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"forwarded": {
"node_modules/forwarded": {
"version": "0.2.0",
"resolved": "https://registry.npmjs.org/forwarded/-/forwarded-0.2.0.tgz",
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow=="
"integrity": "sha512-buRG0fpBtRHSTCOASe6hD258tEubFoRLb4ZNA6NxMVHNw2gOcwHo9wyablzMzOA5z9xA9L1KNjk/Nt6MT9aYow==",
"engines": {
"node": ">= 0.6"
}
},
"fresh": {
"node_modules/fresh": {
"version": "0.5.2",
"resolved": "https://registry.npmjs.org/fresh/-/fresh-0.5.2.tgz",
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac="
"integrity": "sha1-PYyt2Q2XZWn6g1qx+OSyOhBWBac=",
"engines": {
"node": ">= 0.6"
}
},
"http-errors": {
"node_modules/http-errors": {
"version": "1.8.1",
"resolved": "https://registry.npmjs.org/http-errors/-/http-errors-1.8.1.tgz",
"integrity": "sha512-Kpk9Sm7NmI+RHhnj6OIWDI1d6fIoFAtFt9RLaTMRlg/8w49juAStsrBgp0Dp4OdxdVbRIeKhtCUvoi/RuAhO4g==",
"requires": {
"dependencies": {
"depd": "~1.1.2",
"inherits": "2.0.4",
"setprototypeof": "1.2.0",
"statuses": ">= 1.5.0 < 2",
"toidentifier": "1.0.1"
},
"engines": {
"node": ">= 0.6"
}
},
"iconv-lite": {
"node_modules/iconv-lite": {
"version": "0.4.24",
"resolved": "https://registry.npmjs.org/iconv-lite/-/iconv-lite-0.4.24.tgz",
"integrity": "sha512-v3MXnZAcvnywkTUEZomIActle7RXXeedOR31wwl7VlyoXO4Qi9arvSenNQWne1TcRwhCL1HwLI21bEqdpj8/rA==",
"requires": {
"dependencies": {
"safer-buffer": ">= 2.1.2 < 3"
},
"engines": {
"node": ">=0.10.0"
}
},
"inherits": {
"node_modules/inherits": {
"version": "2.0.4",
"resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz",
"integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ=="
},
"ipaddr.js": {
"node_modules/ipaddr.js": {
"version": "1.9.1",
"resolved": "https://registry.npmjs.org/ipaddr.js/-/ipaddr.js-1.9.1.tgz",
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g=="
"integrity": "sha512-0KI/607xoxSToH7GjN1FfSbLoU0+btTicjsQSWQlh/hZykN8KpmMf7uYwPW3R+akZ6R/w18ZlXSHBYXiYUPO3g==",
"engines": {
"node": ">= 0.10"
}
},
"media-typer": {
"node_modules/media-typer": {
"version": "0.3.0",
"resolved": "https://registry.npmjs.org/media-typer/-/media-typer-0.3.0.tgz",
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g="
"integrity": "sha1-hxDXrwqmJvj/+hzgAWhUUmMlV0g=",
"engines": {
"node": ">= 0.6"
}
},
"merge-descriptors": {
"node_modules/merge-descriptors": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/merge-descriptors/-/merge-descriptors-1.0.1.tgz",
"integrity": "sha1-sAqqVW3YtEVoFQ7J0blT8/kMu2E="
},
"methods": {
"node_modules/methods": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/methods/-/methods-1.1.2.tgz",
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4="
"integrity": "sha1-VSmk1nZUE07cxSZmVoNbD4Ua/O4=",
"engines": {
"node": ">= 0.6"
}
},
"mime": {
"node_modules/mime": {
"version": "1.6.0",
"resolved": "https://registry.npmjs.org/mime/-/mime-1.6.0.tgz",
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg=="
"integrity": "sha512-x0Vn8spI+wuJ1O6S7gnbaQg8Pxh4NNHb7KSINmEWKiPE4RKOplvijn+NkmYmmRgP68mc70j2EbeTFRsrswaQeg==",
"bin": {
"mime": "cli.js"
},
"engines": {
"node": ">=4"
}
},
"mime-db": {
"node_modules/mime-db": {
"version": "1.51.0",
"resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
"integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g=="
"integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==",
"engines": {
"node": ">= 0.6"
}
},
"mime-types": {
"node_modules/mime-types": {
"version": "2.1.34",
"resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz",
"integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==",
"requires": {
"dependencies": {
"mime-db": "1.51.0"
},
"engines": {
"node": ">= 0.6"
}
},
"ms": {
"node_modules/ms": {
"version": "2.0.0",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.0.0.tgz",
"integrity": "sha1-VgiurfwAvmwpAd9fmGF4jeDVl8g="
},
"negotiator": {
"node_modules/negotiator": {
"version": "0.6.3",
"resolved": "https://registry.npmjs.org/negotiator/-/negotiator-0.6.3.tgz",
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg=="
"integrity": "sha512-+EUsqGPLsM+j/zdChZjsnX51g4XrHFOIXwfnCVPGlQk/k5giakcKsuxCObBRu6DSm9opw/O6slWbJdghQM4bBg==",
"engines": {
"node": ">= 0.6"
}
},
"on-finished": {
"node_modules/on-finished": {
"version": "2.3.0",
"resolved": "https://registry.npmjs.org/on-finished/-/on-finished-2.3.0.tgz",
"integrity": "sha1-IPEzZIGwg811M3mSoWlxqi2QaUc=",
"requires": {
"dependencies": {
"ee-first": "1.1.1"
},
"engines": {
"node": ">= 0.8"
}
},
"parseurl": {
"node_modules/parseurl": {
"version": "1.3.3",
"resolved": "https://registry.npmjs.org/parseurl/-/parseurl-1.3.3.tgz",
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ=="
"integrity": "sha512-CiyeOxFT/JZyN5m0z9PfXw4SCBJ6Sygz1Dpl0wqjlhDEGGBP1GnsUVEL0p63hoG1fcj3fHynXi9NYO4nWOL+qQ==",
"engines": {
"node": ">= 0.8"
}
},
"path-to-regexp": {
"node_modules/path-to-regexp": {
"version": "0.1.7",
"resolved": "https://registry.npmjs.org/path-to-regexp/-/path-to-regexp-0.1.7.tgz",
"integrity": "sha1-32BBeABfUi8V60SQ5yR6G/qmf4w="
},
"proxy-addr": {
"node_modules/proxy-addr": {
"version": "2.0.7",
"resolved": "https://registry.npmjs.org/proxy-addr/-/proxy-addr-2.0.7.tgz",
"integrity": "sha512-llQsMLSUDUPT44jdrU/O37qlnifitDP+ZwrmmZcoSKyLKvtZxpyV0n2/bD/N4tBAAZ/gJEdZU7KMraoK1+XYAg==",
"requires": {
"dependencies": {
"forwarded": "0.2.0",
"ipaddr.js": "1.9.1"
},
"engines": {
"node": ">= 0.10"
}
},
"qs": {
"node_modules/qs": {
"version": "6.9.6",
"resolved": "https://registry.npmjs.org/qs/-/qs-6.9.6.tgz",
"integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ=="
"integrity": "sha512-TIRk4aqYLNoJUbd+g2lEdz5kLWIuTMRagAXxl78Q0RiVjAOugHmeKNGdd3cwo/ktpf9aL9epCfFqWDEKysUlLQ==",
"engines": {
"node": ">=0.6"
},
"funding": {
"url": "https://github.com/sponsors/ljharb"
}
},
"range-parser": {
"node_modules/range-parser": {
"version": "1.2.1",
"resolved": "https://registry.npmjs.org/range-parser/-/range-parser-1.2.1.tgz",
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg=="
"integrity": "sha512-Hrgsx+orqoygnmhFbKaHE6c296J+HTAQXoxEF6gNupROmmGJRoyzfG3ccAveqCBrwr/2yxQ5BVd/GTl5agOwSg==",
"engines": {
"node": ">= 0.6"
}
},
"raw-body": {
"node_modules/raw-body": {
"version": "2.4.2",
"resolved": "https://registry.npmjs.org/raw-body/-/raw-body-2.4.2.tgz",
"integrity": "sha512-RPMAFUJP19WIet/99ngh6Iv8fzAbqum4Li7AD6DtGaW2RpMB/11xDoalPiJMTbu6I3hkbMVkATvZrqb9EEqeeQ==",
"requires": {
"dependencies": {
"bytes": "3.1.1",
"http-errors": "1.8.1",
"iconv-lite": "0.4.24",
"unpipe": "1.0.0"
},
"engines": {
"node": ">= 0.8"
}
},
"safe-buffer": {
"node_modules/safe-buffer": {
"version": "5.2.1",
"resolved": "https://registry.npmjs.org/safe-buffer/-/safe-buffer-5.2.1.tgz",
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ=="
"integrity": "sha512-rp3So07KcdmmKbGvgaNxQSJr7bGVSVk5S9Eq1F+ppbRo70+YeaDxkw5Dd8NPN+GD6bjnYm2VuPuCXmpuYvmCXQ==",
"funding": [
{
"type": "github",
"url": "https://github.com/sponsors/feross"
},
{
"type": "patreon",
"url": "https://www.patreon.com/feross"
},
{
"type": "consulting",
"url": "https://feross.org/support"
}
]
},
"safer-buffer": {
"node_modules/safer-buffer": {
"version": "2.1.2",
"resolved": "https://registry.npmjs.org/safer-buffer/-/safer-buffer-2.1.2.tgz",
"integrity": "sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg=="
},
"send": {
"node_modules/send": {
"version": "0.17.2",
"resolved": "https://registry.npmjs.org/send/-/send-0.17.2.tgz",
"integrity": "sha512-UJYB6wFSJE3G00nEivR5rgWp8c2xXvJ3OPWPhmuteU0IKj8nKbG3DrjiOmLwpnHGYWAVwA69zmTm++YG0Hmwww==",
"requires": {
"dependencies": {
"debug": "2.6.9",
"depd": "~1.1.2",
"destroy": "~1.0.4",
@ -312,63 +424,85 @@
"range-parser": "~1.2.1",
"statuses": "~1.5.0"
},
"dependencies": {
"ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
}
"engines": {
"node": ">= 0.8.0"
}
},
"serve-static": {
"node_modules/send/node_modules/ms": {
"version": "2.1.3",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.3.tgz",
"integrity": "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="
},
"node_modules/serve-static": {
"version": "1.14.2",
"resolved": "https://registry.npmjs.org/serve-static/-/serve-static-1.14.2.tgz",
"integrity": "sha512-+TMNA9AFxUEGuC0z2mevogSnn9MXKb4fa7ngeRMJaaGv8vTwnIEkKi+QGvPt33HSnf8pRS+WGM0EbMtCJLKMBQ==",
"requires": {
"dependencies": {
"encodeurl": "~1.0.2",
"escape-html": "~1.0.3",
"parseurl": "~1.3.3",
"send": "0.17.2"
},
"engines": {
"node": ">= 0.8.0"
}
},
"setprototypeof": {
"node_modules/setprototypeof": {
"version": "1.2.0",
"resolved": "https://registry.npmjs.org/setprototypeof/-/setprototypeof-1.2.0.tgz",
"integrity": "sha512-E5LDX7Wrp85Kil5bhZv46j8jOeboKq5JMmYM3gVGdGH8xFpPWXUMsNrlODCrkoxMEeNi/XZIwuRvY4XNwYMJpw=="
},
"statuses": {
"node_modules/statuses": {
"version": "1.5.0",
"resolved": "https://registry.npmjs.org/statuses/-/statuses-1.5.0.tgz",
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow="
"integrity": "sha1-Fhx9rBd2Wf2YEfQ3cfqZOBR4Yow=",
"engines": {
"node": ">= 0.6"
}
},
"toidentifier": {
"node_modules/toidentifier": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/toidentifier/-/toidentifier-1.0.1.tgz",
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA=="
"integrity": "sha512-o5sSPKEkg/DIQNmH43V0/uerLrpzVedkUh8tGNvaeXpfpuwjKenlSox/2O/BTlZUtEe+JG7s5YhEz608PlAHRA==",
"engines": {
"node": ">=0.6"
}
},
"type-is": {
"node_modules/type-is": {
"version": "1.6.18",
"resolved": "https://registry.npmjs.org/type-is/-/type-is-1.6.18.tgz",
"integrity": "sha512-TkRKr9sUTxEH8MdfuCSP7VizJyzRNMjj2J2do2Jr3Kym598JVdEksuzPQCnlFPW4ky9Q+iA+ma9BGm06XQBy8g==",
"requires": {
"dependencies": {
"media-typer": "0.3.0",
"mime-types": "~2.1.24"
},
"engines": {
"node": ">= 0.6"
}
},
"unpipe": {
"node_modules/unpipe": {
"version": "1.0.0",
"resolved": "https://registry.npmjs.org/unpipe/-/unpipe-1.0.0.tgz",
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw="
"integrity": "sha1-sr9O6FFKrmFltIF4KdIbLvSZBOw=",
"engines": {
"node": ">= 0.8"
}
},
"utils-merge": {
"node_modules/utils-merge": {
"version": "1.0.1",
"resolved": "https://registry.npmjs.org/utils-merge/-/utils-merge-1.0.1.tgz",
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM="
"integrity": "sha1-n5VxD1CiZ5R7LMwSR0HBAoQn5xM=",
"engines": {
"node": ">= 0.4.0"
}
},
"vary": {
"node_modules/vary": {
"version": "1.1.2",
"resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw="
"integrity": "sha1-IpnwLG3tMNSllhsLn3RSShj2NPw=",
"engines": {
"node": ">= 0.8"
}
}
}
}

View File

@ -14,7 +14,9 @@ And one subscriber:
- Node subscriber `order-processor`
### Run Node message subscriber with Dapr
## Run all apps with multi-app run template file:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Install dependencies:
@ -25,61 +27,100 @@ name: Install Node dependencies
```bash
cd ./order-processor
npm install
cd ..
cd ./checkout
npm install
```
<!-- END_STEP -->
3. Run the Node publisher app with Dapr:
2. Open a new terminal window and run the multi app run template:
<!-- STEP
name: Run Node publisher
name: Run multi app run template
expected_stdout_lines:
- '== APP == Subscriber received: {"orderId":2}'
- "Exited App successfully"
- 'Started Dapr with app id "order-processor"'
- 'Started Dapr with app id "checkout-sdk"'
- '== APP - checkout-sdk == Published data: {"orderId":1}'
- '== APP - order-processor == Subscriber received: {"orderId":1}'
expected_stderr_lines:
working_dir: ./order-processor
output_match_mode: substring
match_order: none
background: true
sleep: 10
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
The terminal console output should look similar to this:
```text
== APP - checkout-sdk == Published data: {"orderId":1}
== APP - order-processor == Subscriber received: {"orderId":1}
== APP - checkout-sdk == Published data: {"orderId":2}
== APP - order-processor == Subscriber received: {"orderId":2}
== APP - checkout-sdk == Published data: {"orderId":3}
== APP - order-processor == Subscriber received: {"orderId":3}
== APP - checkout-sdk == Published data: {"orderId":4}
== APP - order-processor == Subscriber received: {"orderId":4}
== APP - checkout-sdk == Published data: {"orderId":5}
== APP - order-processor == Subscriber received: {"orderId":5}
== APP - checkout-sdk == Published data: {"orderId":6}
== APP - order-processor == Subscriber received: {"orderId":6}
== APP - checkout-sdk == Published data: {"orderId":7}
== APP - order-processor == Subscriber received: {"orderId":7}
== APP - checkout-sdk == Published data: {"orderId":8}
== APP - order-processor == Subscriber received: {"orderId":8}
== APP - checkout-sdk == Published data: {"orderId":9}
== APP - order-processor == Subscriber received: {"orderId":9}
== APP - checkout-sdk == Published data: {"orderId":10}
== APP - order-processor == Subscriber received: {"orderId":10}
```
3. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- dotnet run` commands. This next section covers how to do this.
### Run Node message subscriber with Dapr
1. Install dependencies:
```bash
cd ./order-processor
npm install
```
2. Run the Node publisher app with Dapr:
```bash
dapr run --app-port 5002 --app-id order-processing-sdk --app-protocol http --dapr-http-port 3501 --resources-path ../../../components -- npm run start
```
<!-- END_STEP -->
### Run Node message publisher with Dapr
1. Install dependencies:
<!-- STEP
name: Install Node dependencies
-->
```bash
cd ./checkout
npm install
```
<!-- END_STEP -->
3. Run the Node publisher app with Dapr:
<!-- STEP
name: Run Node publisher
expected_stdout_lines:
- '== APP == Published data: {"orderId":2}'
- '== APP == Published data: {"orderId":3}'
- "Exited App successfully"
expected_stderr_lines:
working_dir: ./checkout
output_match_mode: substring
background: true
sleep: 10
-->
2. Run the Node publisher app with Dapr:
```bash
dapr run --app-id checkout-sdk --app-protocol http --dapr-http-port 3500 --resources-path ../../../components -- npm run start
```
<!-- END_STEP -->
### Stop the apps and clean up
```bash
dapr stop --app-id checkout-sdk

View File

@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor
appDirPath: ./order-processor/
appPort: 5002
command: ["npm", "run", "start"]
- appID: checkout-sdk
appDirPath: ./checkout/
command: ["npm", "run", "start"]

View File

@ -14,73 +14,119 @@ And one subscriber:
- Python subscriber `order-processor`
### Run Python message subscriber with Dapr
## Run all apps with multi-app run template file:
2. Install dependencies:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Install dependencies:
<!-- STEP
name: Install python dependencies
name: Install Python dependencies
-->
```bash
cd ./checkout
pip3 install -r requirements.txt
cd ..
cd ./order-processor
pip3 install -r requirements.txt
cd ..
```
<!-- END_STEP -->
2. Open a new terminal window and run the multi app run template:
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor-http"'
- 'Started Dapr with app id "checkout-http"'
- '== APP - checkout-http == INFO:root:Published data: {"orderId": 1}'
- '== APP - order-processor-http == Subscriber received : 1'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
The terminal console output should look similar to this:
```text
== APP - order-processor-http == Subscriber received : 1
== APP - order-processor-http == 127.0.0.1 - - [04/Sep/2023 11:33:21] "POST /orders HTTP/1.1" 200 -
== APP - checkout-http == INFO:root:Published data: {"orderId": 2}
== APP - order-processor-http == Subscriber received : 2
== APP - order-processor-http == 127.0.0.1 - - [04/Sep/2023 11:33:22] "POST /orders HTTP/1.1" 200 -
== APP - checkout-http == INFO:root:Published data: {"orderId": 3}
== APP - order-processor-http == Subscriber received : 3
== APP - order-processor-http == 127.0.0.1 - - [04/Sep/2023 11:33:23] "POST /orders HTTP/1.1" 200 -
== APP - checkout-http == INFO:root:Published data: {"orderId": 4}
== APP - order-processor-http == Subscriber received : 4
== APP - order-processor-http == 127.0.0.1 - - [04/Sep/2023 11:33:24] "POST /orders HTTP/1.1" 200 -
== APP - checkout-http == INFO:root:Published data: {"orderId": 5}
== APP - order-processor-http == Subscriber received : 5
== APP - order-processor-http == 127.0.0.1 - - [04/Sep/2023 11:33:25] "POST /orders HTTP/1.1" 200 -
== APP - order-processor-http == 127.0.0.1 - - [04/Sep/2023 11:33:26] "POST /orders HTTP/1.1" 200 -
== APP - order-processor-http == Subscriber received : 6
== APP - checkout-http == INFO:root:Published data: {"orderId": 6}
== APP - checkout-http == INFO:root:Published data: {"orderId": 7}
== APP - order-processor-http == Subscriber received : 7
== APP - order-processor-http == 127.0.0.1 - - [04/Sep/2023 11:33:27] "POST /orders HTTP/1.1" 200 -
== APP - checkout-http == INFO:root:Published data: {"orderId": 8}
== APP - order-processor-http == Subscriber received : 8
== APP - order-processor-http == 127.0.0.1 - - [04/Sep/2023 11:33:28] "POST /orders HTTP/1.1" 200 -
== APP - checkout-http == INFO:root:Published data: {"orderId": 9}
== APP - order-processor-http == Subscriber received : 9
== APP - order-processor-http == 127.0.0.1 - - [04/Sep/2023 11:33:29] "POST /orders HTTP/1.1" 200 -
```
3. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- python3 app.py` commands. This next section covers how to do this.
### Run Python message subscriber with Dapr
1. Install dependencies:
```bash
cd ./order-processor
pip3 install -r requirements.txt
pip3 install -r requirements.txt
```
<!-- END_STEP -->
3. Run the Python subscriber app with Dapr:
<!-- STEP
name: Run python subscriber
expected_stdout_lines:
- '== APP == Subscriber received : 2'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
working_dir: ./order-processor
background: true
sleep: 10
-->
2. Run the Python subscriber app with Dapr:
```bash
dapr run --app-id order-processor-http --resources-path ../../../components/ --app-port 6001 -- python3 app.py
dapr run --app-id order-processor-http --resources-path ../../../components/ --app-port 6021 -- uvicorn app:app --port 6002
```
<!-- END_STEP -->
### Run Python message publisher with Dapr
1. Install dependencies:
<!-- STEP
name: Install python dependencies
-->
```bash
cd ./checkout
pip3 install -r requirements.txt
```
<!-- END_STEP -->
3. Run the Python publisher app with Dapr:
<!-- STEP
name: Run python publisher
expected_stdout_lines:
- '== APP == INFO:root:Published data: {"orderId": 1}'
- '== APP == INFO:root:Published data: {"orderId": 2}'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
working_dir: ./checkout
background: true
sleep: 10
-->
2. Run the Python publisher app with Dapr:
```bash
dapr run --app-id checkout-http --resources-path ../../../components/ -- python3 app.py
```
<!-- END_STEP -->
### Stop the apps and clean up
```bash
dapr stop --app-id checkout-http

View File

@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor-http
appDirPath: ./order-processor/
appPort: 6021
command: ["uvicorn", "app:app"]
- appID: checkout-http
appDirPath: ./checkout/
command: ["python3", "app.py"]

View File

@ -14,104 +14,128 @@ And one subscriber:
- Python subscriber `order-processor`
### Run Python message subscriber with Dapr
## Run all apps with multi-app run template file:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Install dependencies:
1. Run the Python subscriber app (flask version) with Dapr:
<!-- STEP
name: run
name: Install Python dependencies
-->
```bash
cd ./checkout
pip3 install -r requirements.txt
cd ..
cd ./order-processor
pip3 install -r requirements.txt
cd ..
cd ./order-processor-fastapi
pip3 install -r requirements.txt
cd ..
```
<!-- END_STEP -->
2. Open a new terminal window and run the multi app run template:
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor-sdk"'
- 'Started Dapr with app id "checkout-sdk"'
- '== APP - checkout-sdk == INFO:root:Published data: {"orderId": 1}'
- '== APP - order-processor-sdk == Subscriber received : 1'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
The terminal console output should look similar to this:
```text
== APP - checkout-sdk == INFO:root:Published data: {"orderId": 1}
== APP - order-processor-sdk == Subscriber received : 1
== APP - order-processor-sdk == 127.0.0.1 - - [04/Sep/2023 11:15:19] "POST /orders HTTP/1.1" 200 -
== APP - checkout-sdk == INFO:root:Published data: {"orderId": 2}
== APP - order-processor-sdk == 127.0.0.1 - - [04/Sep/2023 11:15:20] "POST /orders HTTP/1.1" 200 -
== APP - order-processor-sdk == Subscriber received : 2
== APP - checkout-sdk == INFO:root:Published data: {"orderId": 3}
== APP - order-processor-sdk == Subscriber received : 3
== APP - order-processor-sdk == 127.0.0.1 - - [04/Sep/2023 11:15:21] "POST /orders HTTP/1.1" 200 -
== APP - checkout-sdk == INFO:root:Published data: {"orderId": 4}
== APP - order-processor-sdk == Subscriber received : 4
== APP - order-processor-sdk == 127.0.0.1 - - [04/Sep/2023 11:15:22] "POST /orders HTTP/1.1" 200 -
== APP - checkout-sdk == INFO:root:Published data: {"orderId": 5}
== APP - order-processor-sdk == Subscriber received : 5
== APP - order-processor-sdk == 127.0.0.1 - - [04/Sep/2023 11:15:23] "POST /orders HTTP/1.1" 200 -
== APP - checkout-sdk == INFO:root:Published data: {"orderId": 6}
== APP - order-processor-sdk == Subscriber received : 6
== APP - order-processor-sdk == 127.0.0.1 - - [04/Sep/2023 11:15:24] "POST /orders HTTP/1.1" 200 -
== APP - checkout-sdk == INFO:root:Published data: {"orderId": 7}
== APP - order-processor-sdk == 127.0.0.1 - - [04/Sep/2023 11:15:25] "POST /orders HTTP/1.1" 200 -
== APP - order-processor-sdk == Subscriber received : 7
== APP - checkout-sdk == INFO:root:Published data: {"orderId": 8}
== APP - order-processor-sdk == 127.0.0.1 - - [04/Sep/2023 11:15:26] "POST /orders HTTP/1.1" 200 -
== APP - order-processor-sdk == Subscriber received : 8
== APP - checkout-sdk == INFO:root:Published data: {"orderId": 9}
== APP - order-processor-sdk == 127.0.0.1 - - [04/Sep/2023 11:15:27] "POST /orders HTTP/1.1" 200 -
== APP - order-processor-sdk == Subscriber received : 9
```
3. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- python3 app.py` commands. This next section covers how to do this.
### Run Python message subscriber with Dapr
1. Install dependencies:
```bash
cd ./order-processor
pip3 install -r requirements.txt
```
<!-- END_STEP -->
<!-- STEP
name: Run python subscriber
expected_stdout_lines:
- '== APP == Subscriber received : 4'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
working_dir: ./order-processor
background: true
sleep: 10
-->
2. Run the Python subscriber app with Dapr:
```bash
dapr run --app-id order-processor-sdk --resources-path ../../../components/ --app-port 6002 -- uvicorn app:app --port 6002
dapr run --app-id order-processor-sdk --resources-path ../../../components/ --app-port 6001 -- uvicorn app:app --port 6002
```
<!-- END_STEP -->
2. Run the Python subscriber app (fastapi version) with Dapr:
<!-- STEP
name: run
-->
```bash
cd ./order-processor-fastapi
pip3 install -r requirements.txt
```
<!-- END_STEP -->
<!-- STEP
name: Run python subscriber
expected_stdout_lines:
- '== APP == Subscriber received : 4'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
working_dir: ./order-processor-fastapi
background: true
sleep: 10
-->
```bash
dapr run --app-id order-processor-sdk-fastapi --resources-path ../../../components/ --app-port 6003 -- uvicorn app:app --port 6003
```
<!-- END_STEP -->
### Run Python message publisher with Dapr
1. Install dependencies:
<!-- STEP
name: Install python dependencies
-->
```bash
cd ./checkout
pip3 install -r requirements.txt
```
<!-- END_STEP -->
2. Run the Python publisher app with Dapr:
<!-- STEP
name: Run python publisher
expected_stdout_lines:
- '== APP == INFO:root:Published data: {"orderId": 1}'
- '== APP == INFO:root:Published data: {"orderId": 2}'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
working_dir: ./checkout
background: true
sleep: 10
-->
```bash
dapr run --app-id checkout-sdk --resources-path ../../../components/ -- python3 app.py
```
<!-- END_STEP -->
### Stop the apps and clean up
```bash
dapr stop --app-id checkout-sdk

View File

@ -0,0 +1,11 @@
version: 1
common:
resourcesPath: ../../components/
apps:
- appID: order-processor-sdk
appDirPath: ./order-processor/
appPort: 6001
command: ["uvicorn", "app:app"]
- appID: checkout-sdk
appDirPath: ./checkout/
command: ["python3", "app.py"]

View File

@ -6,132 +6,97 @@ Visit [this](https://docs.dapr.io/developing-applications/building-blocks/servic
This quickstart includes one checkout service:
- Dotnet client service `checkout`
- .NET client service `checkout`
And one order processor service:
- Dotnet order-processor service `order-processor`
- .NET order-processor service `order-processor`
### Run Dotnet order-processor with Dapr
## Run all apps with multi-app run template file:
1. Open a new terminal window and navigate to `order-processor` directory and install dependencies:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
<!-- STEP
name: Install Dotnet dependencies
-->
```bash
cd ./order-processor
dotnet restore
dotnet build
```
<!-- END_STEP -->
2. Run the Dotnet order-processor app with Dapr:
<!-- STEP
name: Run order-processor service
expected_stdout_lines:
- '== APP == Order received : Order { orderId = 10 }'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 10
-->
```bash
cd ./order-processor
dapr run --app-port 7001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- dotnet run
```
<!-- END_STEP -->
### Run Dotnet checkout with Dapr
1. Open a new terminal window and navigate to the `checkout` directory and install dependencies:
<!-- STEP
name: Install Dotnet dependencies
-->
```bash
cd ./checkout
dotnet restore
dotnet build
```
<!-- END_STEP -->
2. Run the Dotnet checkout app with Dapr:
<!-- STEP
name: Run checkout service
expected_stdout_lines:
- '== APP == Order passed: Order { OrderId = 1 }'
- '== APP == Order passed: Order { OrderId = 2 }'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 10
-->
```bash
cd ./checkout
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- dotnet run
```
<!-- END_STEP -->
```bash
dapr stop --app-id order-processor
```
### Start all apps with multi app run template file:
1. Open a new terminal window and install dependencies for `order-processor` and `checkout` apps:
<!-- STEP
name: Install Dotnet dependencies for order-processor and checkout
-->
```bash
cd ./order-processor
dotnet restore
dotnet build
cd ../checkout
dotnet restore
dotnet build
```
<!-- END_STEP -->
2. Run the multi app run template:
1. Open a new terminal window and run `order-processor` and `checkout` using the multi app run template defined in [dapr.yaml](./dapr.yaml):
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'This is a preview feature and subject to change in future releases'
- 'Validating config and starting app "order-processor"'
- 'Started Dapr with app id "order-processor"'
- 'Writing log files to directory'
- 'Validating config and starting app "checkout"'
- 'Started Dapr with app id "checkout"'
- 'Writing log files to directory'
- '== APP - order-processor == Order received : Order { orderId = 10 }'
- '== APP - checkout == Order passed: Order { OrderId = 10 }'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
<!-- END_STEP -->
The terminal console output should look similar to this:
```text
== APP - order-processor == Order received : Order { orderId = 1 }
== APP - checkout == Order passed: Order { OrderId = 1 }
== APP - order-processor == Order received : Order { orderId = 2 }
== APP - checkout == Order passed: Order { OrderId = 2 }
== APP - order-processor == Order received : Order { orderId = 3 }
== APP - checkout == Order passed: Order { OrderId = 3 }
== APP - order-processor == Order received : Order { orderId = 4 }
== APP - checkout == Order passed: Order { OrderId = 4 }
== APP - order-processor == Order received : Order { orderId = 5 }
== APP - checkout == Order passed: Order { OrderId = 5 }
== APP - order-processor == Order received : Order { orderId = 6 }
== APP - checkout == Order passed: Order { OrderId = 6 }
== APP - order-processor == Order received : Order { orderId = 7 }
== APP - checkout == Order passed: Order { OrderId = 7 }
== APP - order-processor == Order received : Order { orderId = 8 }
== APP - checkout == Order passed: Order { OrderId = 8 }
== APP - order-processor == Order received : Order { orderId = 9 }
== APP - checkout == Order passed: Order { OrderId = 9 }
== APP - order-processor == Order received : Order { orderId = 10 }
== APP - checkout == Order passed: Order { OrderId = 10 }
```
2. Stop and clean up application processes
```bash
dapr stop -f .
```
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- dotnet run` commands. This next section covers how to do this.
### Run .NET `order-processor` with Dapr
1. Open a new terminal window and run the Dotnet order-processor app with Dapr:
```bash
cd ./order-processor
dapr run --app-port 7001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- dotnet run
```
### Run .NET `checkout` with Dapr
1. Open a new terminal and run the Dotnet checkout app with Dapr:
```bash
cd ./checkout
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- dotnet run
```
### Stop and clean up application processes
```bash
dapr stop --app-id order-processor
dapr stop --app-id checkout
```

View File

@ -8,21 +8,70 @@ This quickstart includes one checkout service: Go client service `checkout`
And one order processor service: Go order-processor service `order-processor`
## Run all apps with multi-app run template file:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Open a new terminal window and run the multi app run template:
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor"'
- 'Started Dapr with app id "checkout"'
- '== APP - order-processor == Order received: {"orderId":10}'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
The terminal console output should look similar to this:
```text
== APP - checkout-http == Published data: {"orderId":1}
== APP - order-processor == Subscriber received: {"orderId":1}
== APP - checkout-http == Published data: {"orderId":2}
== APP - order-processor == Subscriber received: {"orderId":2}
== APP - checkout-http == Published data: {"orderId":3}
== APP - order-processor == Subscriber received: {"orderId":3}
== APP - checkout-http == Published data: {"orderId":4}
== APP - order-processor == Subscriber received: {"orderId":4}
== APP - checkout-http == Published data: {"orderId":5}
== APP - order-processor == Subscriber received: {"orderId":5}
== APP - checkout-http == Published data: {"orderId":6}
== APP - order-processor == Subscriber received: {"orderId":6}
== APP - checkout-http == Published data: {"orderId":7}
== APP - order-processor == Subscriber received: {"orderId":7}
== APP - checkout-http == Published data: {"orderId":8}
== APP - order-processor == Subscriber received: {"orderId":8}
== APP - checkout-http == Published data: {"orderId":9}
== APP - order-processor == Subscriber received: {"orderId":9}
== APP - checkout-http == Published data: {"orderId":10}
== APP - order-processor == Subscriber received: {"orderId":10}
```
3. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- go run .` commands. This next section covers how to do this.
### Run Go order-processor with Dapr
1. Run the order-processor app with Dapr in the `order-processor` folder:
<!-- STEP
name: Run order-processor service
expected_stdout_lines:
- '== APP == Order received: {"orderId":10}'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
cd ./order-processor
dapr run \
@ -33,24 +82,10 @@ dapr run \
-- go run .
```
<!-- END_STEP -->
### Run Go checkout with Dapr
1. Open a new terminal window and navigate to `checkout` directory, then run the Go checkout app with Dapr:
<!-- STEP
name: Run checkout service
expected_stdout_lines:
- '== APP == Order passed: {"orderId":1}'
- '== APP == Order passed: {"orderId":2}'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
cd ./checkout
dapr run \
@ -59,41 +94,9 @@ dapr run \
-- go run .
```
<!-- END_STEP -->
To stop:
### Stop the apps and clean up
```bash
dapr stop --app-id checkout
dapr stop --app-id order-processor
```
### Start all apps with multi app run template file:
1. Run the multi app run template:
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'This is a preview feature and subject to change in future releases'
- 'Validating config and starting app "order-processor"'
- 'Started Dapr with app id "order-processor"'
- 'Writing log files to directory'
- 'Validating config and starting app "checkout"'
- 'Started Dapr with app id "checkout"'
- 'Writing log files to directory'
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
dapr run -f .
```
<!-- END_STEP -->
```bash
dapr stop -f .
```

View File

@ -21,80 +21,9 @@ And one order processor service:
* [OpenJDK 11](https://jdk.java.net/11/)
* [Apache Maven](https://maven.apache.org/install.html) version 3.x.
### Run Java order-processor with Dapr
## Run all apps with multi-app run template file:
1. Open a new terminal window and navigate to `order-processor` directory and install dependencies:
<!-- STEP
name: Install maven dependencies
-->
```bash
cd ./order-processor
mvn clean install
```
<!-- END_STEP -->
2. Run the Java order-processor app with Dapr:
<!-- STEP
name: Run Java order-processor service
expected_stdout_lines:
- "== APP == Order received: 1"
- "== APP == Order received: 2"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 10
-->
```bash
cd ./order-processor
dapr run --app-id order-processor --app-port 9001 --app-protocol http --dapr-http-port 3501 -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar
```
<!-- END_STEP -->
### Run Java checkout service with Dapr
1. Open a new terminal window and navigate to `checkout` directory and install dependencies:
<!-- STEP
name: Install maven dependencies
-->
```bash
cd ./checkout
mvn clean install
```
<!-- END_STEP -->
2. Run the Java checkout app with Dapr:
<!-- STEP
name: Run Java checkout service
expected_stdout_lines:
- "== APP == Order passed: 1"
- "== APP == Order passed: 2"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
cd ./checkout
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- java -jar target/CheckoutService-0.0.1-SNAPSHOT.jar
```
<!-- END_STEP -->
```bash
dapr stop --app-id checkout
dapr stop --app-id order-processor
```
### Start all apps with multi app run template file:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Open a new terminal window and install dependencies for `order-processor` and `checkout` apps:
@ -107,6 +36,7 @@ cd ./order-processor
mvn clean install
cd ../checkout
mvn clean install
cd ..
```
<!-- END_STEP -->
@ -116,7 +46,6 @@ mvn clean install
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'This is a preview feature and subject to change in future releases'
- 'Validating config and starting app "order-processor"'
- 'Started Dapr with app id "order-processor"'
- 'Writing log files to directory'
@ -125,16 +54,89 @@ expected_stdout_lines:
- 'Writing log files to directory'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
<!-- END_STEP -->
The terminal console output should look similar to this:
```text
== APP - order-processor == Order received: 1
== APP - checkout == Order passed: 1
== APP - order-processor == Order received: 2
== APP - checkout == Order passed: 2
== APP - order-processor == Order received: 3
== APP - checkout == Order passed: 3
== APP - order-processor == Order received: 4
== APP - checkout == Order passed: 4
== APP - order-processor == Order received: 5
== APP - checkout == Order passed: 5
== APP - order-processor == Order received: 6
== APP - checkout == Order passed: 6
== APP - order-processor == Order received: 7
== APP - checkout == Order passed: 7
== APP - order-processor == Order received: 8
== APP - checkout == Order passed: 8
== APP - order-processor == Order received: 9
== APP - checkout == Order passed: 9
== APP - order-processor == Order received: 10
== APP - checkout == Order passed: 10
== APP - order-processor == Order received: 11
== APP - checkout == Order passed: 11
== APP - order-processor == Order received: 12
== APP - checkout == Order passed: 12
```
3. Stop and clean up application processes
```bash
dapr stop -f .
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- java -jar` commands. This next section covers how to do this.
### Run Java order-processor with Dapr
1. Open a new terminal window and navigate to `order-processor` directory and install dependencies:
```bash
cd ./order-processor
mvn clean install
```
2. Run the Java order-processor app with Dapr:
```bash
dapr run --app-id order-processor --app-port 9001 --app-protocol http --dapr-http-port 3501 -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar
```
### Run Java checkout service with Dapr
1. Open a new terminal window and navigate to `checkout` directory and install dependencies:
```bash
cd ./checkout
mvn clean install
```
2. Run the Java checkout app with Dapr:
```bash
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- java -jar target/CheckoutService-0.0.1-SNAPSHOT.jar
```
### Stop and clean up application processes
```bash
dapr stop --app-id checkout
dapr stop --app-id order-processor
```

View File

@ -12,83 +12,9 @@ And one order-processor service:
- Node order-processor service `order-processor`
### Run Node order-processor with Dapr
## Run all apps with multi-app run template file:
1. Open a new terminal window and navigate to `order-processor` directory and install dependencies:
<!-- STEP
name: Install Node dependencies
-->
```bash
cd ./order-processor
npm install
```
<!-- END_STEP -->
3. Run the Node order-processor app with Dapr:
<!-- STEP
name: Run order-processor service
expected_stdout_lines:
- '== APP == Order received: { orderId: 10 }'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
cd ./order-processor
dapr run --app-port 5001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- npm start
```
<!-- END_STEP -->
### Run Node checkout with Dapr
1. Open a new terminal window and navigate to `checkout` directory and install dependencies:
<!-- STEP
name: Install Node dependencies
-->
```bash
cd ./checkout
npm install
```
<!-- END_STEP -->
2. Run the Node checkout app with Dapr:
<!-- STEP
name: Run checkout service
expected_stdout_lines:
- '== APP == Order passed: {"orderId":1}'
- '== APP == Order passed: {"orderId":2}'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
cd ./checkout
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- npm start
```
<!-- END_STEP -->
```bash
dapr stop --app-id checkout
dapr stop --app-id order-processor
```
### Start all apps with multi app run template file:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Open a new terminal window and install dependencies for `order-processor` and `checkout` apps:
@ -101,6 +27,7 @@ cd ./order-processor
npm install
cd ../checkout
npm install
cd ..
```
<!-- END_STEP -->
@ -110,7 +37,6 @@ npm install
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'This is a preview feature and subject to change in future releases'
- 'Validating config and starting app "order-processor"'
- 'Started Dapr with app id "order-processor"'
- 'Writing log files to directory'
@ -119,16 +45,90 @@ expected_stdout_lines:
- 'Writing log files to directory'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
<!-- END_STEP -->
The terminal console output should look similar to this:
```text
== APP - order-processor == Order received: { orderId: 1 }
== APP - checkout == Order passed: {"orderId":1}
== APP - order-processor == Order received: { orderId: 2 }
== APP - checkout == Order passed: {"orderId":2}
== APP - order-processor == Order received: { orderId: 3 }
== APP - checkout == Order passed: {"orderId":3}
== APP - order-processor == Order received: { orderId: 4 }
== APP - checkout == Order passed: {"orderId":4}
== APP - order-processor == Order received: { orderId: 5 }
== APP - checkout == Order passed: {"orderId":5}
== APP - order-processor == Order received: { orderId: 6 }
== APP - checkout == Order passed: {"orderId":6}
== APP - order-processor == Order received: { orderId: 7 }
== APP - checkout == Order passed: {"orderId":7}
== APP - order-processor == Order received: { orderId: 8 }
== APP - checkout == Order passed: {"orderId":8}
== APP - order-processor == Order received: { orderId: 9 }
== APP - checkout == Order passed: {"orderId":9}
== APP - order-processor == Order received: { orderId: 10 }
== APP - checkout == Order passed: {"orderId":10}
== APP - order-processor == Order received: { orderId: 11 }
== APP - checkout == Order passed: {"orderId":11}
== APP - order-processor == Order received: { orderId: 12 }
== APP - checkout == Order passed: {"orderId":12}
```
3. Stop and clean up application processes
```bash
dapr stop -f .
```
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- npm start` commands. This next section covers how to do this.
### Run Node order-processor with Dapr
1. Open a new terminal window and navigate to `order-processor` directory and install dependencies:
```bash
cd ./order-processor
npm install
```
3. Run the Node order-processor app with Dapr:
```bash
dapr run --app-port 5001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- npm start
```
### Run Node checkout with Dapr
1. Open a new terminal window and navigate to `checkout` directory and install dependencies:
```bash
cd ./checkout
npm install
```
2. Run the Node checkout app with Dapr:
```bash
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- npm start
```
### Stop and clean up application processes
```bash
dapr stop --app-id checkout
dapr stop --app-id order-processor
```

View File

@ -12,88 +12,30 @@ And one order processor service:
- Python order-processor service `order-processor`
### Run Python order-processor with Dapr
## Run all apps with multi-app run template file:
1. Install dependencies for `order-processor` app:
This section shows how to run both applications at once using [multi-app run template files](https://docs.dapr.io/developing-applications/local-development/multi-app-dapr-run/multi-app-overview/) with `dapr run -f .`. This enables to you test the interactions between multiple applications.
1. Open a new terminal window and install dependencies for `order-processor` and `checkout` apps:
<!-- STEP
name: Install Python dependencies
name: Install Node dependencies for order-processor and checkout
-->
```bash
cd ./order-processor
pip3 install -r requirements.txt
```
<!-- END_STEP -->
2. Run the Python order-processor app with Dapr:
<!-- STEP
name: Run order-processor service
expected_stdout_lines:
- '== APP == Order received : {"orderId": 10}'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
dapr run --app-port 8001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- python3 order-processor/app.py
```
<!-- END_STEP -->
### Run Python checkout with Dapr
1. Open a new terminal window and install dependencies for `checkout` app:
<!-- STEP
name: Install Python dependencies
-->
```bash
cd ./checkout
cd ../checkout
pip3 install -r requirements.txt
cd ..
```
<!-- END_STEP -->
2. Run the Python checkout app with Dapr:
<!-- STEP
name: Run checkout service
expected_stdout_lines:
- '== APP == Order passed: {"orderId": 1}'
- '== APP == Order passed: {"orderId": 2}'
- "Exited App successfully"
expected_stderr_lines:
output_match_mode: substring
background: true
sleep: 15
-->
```bash
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- python3 checkout/app.py
```
<!-- END_STEP -->
```bash
dapr stop --app-id checkout
dapr stop --app-id order-processor
```
### Start all apps with multi app run template file:
The dependencies are already installed from previous steps. Simply run the multi app run template. It uses `dapr.yaml` file to determine which applications to run.
2. Run the multi app run template:
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'This is a preview feature and subject to change in future releases'
- 'Validating config and starting app "order-processor"'
- 'Started Dapr with app id "order-processor"'
- 'Writing log files to directory'
@ -102,18 +44,95 @@ expected_stdout_lines:
- 'Writing log files to directory'
expected_stderr_lines:
output_match_mode: substring
match_order: none
background: true
sleep: 15
timeout_seconds: 30
-->
```bash
dapr run -f .
```
<!-- END_STEP -->
The terminal console output should look similar to this:
Finally, stop all:
```text
== APP - order-processor == Order received : {"orderId": 1}
== APP - order-processor == 127.0.0.1 - - [DATE] "POST /orders HTTP/1.1" 200 -
== APP - checkout == Order passed: {"orderId": 1}
== APP - order-processor == Order received : {"orderId": 2}
== APP - order-processor == 127.0.0.1 - - [DATE] "POST /orders HTTP/1.1" 200 -
== APP - checkout == Order passed: {"orderId": 2}
== APP - order-processor == Order received : {"orderId": 3}
== APP - order-processor == 127.0.0.1 - - [DATE] "POST /orders HTTP/1.1" 200 -
== APP - checkout == Order passed: {"orderId": 3}
== APP - order-processor == Order received : {"orderId": 4}
== APP - order-processor == 127.0.0.1 - - [DATE] "POST /orders HTTP/1.1" 200 -
== APP - checkout == Order passed: {"orderId": 4}
== APP - order-processor == Order received : {"orderId": 5}
== APP - order-processor == 127.0.0.1 - - [DATE] "POST /orders HTTP/1.1" 200 -
== APP - checkout == Order passed: {"orderId": 5}
== APP - order-processor == Order received : {"orderId": 6}
== APP - order-processor == 127.0.0.1 - - [DATE] "POST /orders HTTP/1.1" 200 -
== APP - checkout == Order passed: {"orderId": 6}
== APP - order-processor == Order received : {"orderId": 7}
== APP - order-processor == 127.0.0.1 - - [DATE] "POST /orders HTTP/1.1" 200 -
== APP - checkout == Order passed: {"orderId": 7}
== APP - order-processor == Order received : {"orderId": 8}
== APP - order-processor == 127.0.0.1 - - [DATE] "POST /orders HTTP/1.1" 200 -
== APP - checkout == Order passed: {"orderId": 8}
== APP - order-processor == Order received : {"orderId": 9}
== APP - order-processor == 127.0.0.1 - - [DATE] "POST /orders HTTP/1.1" 200 -
== APP - checkout == Order passed: {"orderId": 9}
== APP - order-processor == Order received : {"orderId": 10}
== APP - order-processor == 127.0.0.1 - - [DATE] "POST /orders HTTP/1.1" 200 -
== APP - checkout == Order passed: {"orderId": 10}
```
3. Stop and clean up application processes
```bash
dapr stop -f .
```
```
<!-- END_STEP -->
## Run a single app at a time with Dapr (Optional)
An alternative to running all or multiple applications at once is to run single apps one-at-a-time using multiple `dapr run .. -- python3 app.py` commands. This next section covers how to do this.
### Run Python order-processor with Dapr
1. Install dependencies for `order-processor` app:
```bash
cd ./order-processor
pip3 install -r requirements.txt
```
2. Run the Python order-processor app with Dapr:
```bash
dapr run --app-port 8001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- python3 app.py
```
### Run Python checkout with Dapr
1. Open a new terminal window and install dependencies for `checkout` app:
```bash
cd ./checkout
pip3 install -r requirements.txt
```
2. Run the Python checkout app with Dapr:
```bash
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- python3 app.py
```
### Stop and clean up application processes
```bash
dapr stop --app-id checkout
dapr stop --app-id order-processor
```