Fix inconsistent dapr.yaml and appIDs (#1152)

* Fix inconsistent multi-app run files

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* Rename appID for consistency

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* Update appID for consistency

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* fix appID

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* Fix appID

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

* Remove schedulerHostAddress

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>

---------

Signed-off-by: Marc Duiker <marcduiker@users.noreply.github.com>
This commit is contained in:
Marc Duiker 2025-02-03 16:44:02 +01:00 committed by GitHub
parent ce7638acdc
commit 9449aa4252
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
24 changed files with 201 additions and 203 deletions

View File

@ -20,11 +20,11 @@ Open a new terminal window and run the multi app run template:
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- '== APP - job-service == Received job request...'
- '== APP - job-service == Executing maintenance job: Oil Change'
- '== APP - job-scheduler == Job Scheduled: C-3PO'
- '== APP - job-service == Received job request...'
- '== APP - job-service == Executing maintenance job: Limb Calibration'
- '== APP - job-service-http == Received job request...'
- '== APP - job-service-http == Executing maintenance job: Oil Change'
- '== APP - job-scheduler-http == Job Scheduled: C-3PO'
- '== APP - job-service-http == Received job request...'
- '== APP - job-service-http == Executing maintenance job: Limb Calibration'
expected_stderr_lines:
output_match_mode: substring
match_order: none
@ -45,20 +45,20 @@ The terminal console output should look similar to this, where:
- The `C-3PO` job is being retrieved.
```text
== APP - job-scheduler == Job Scheduled: R2-D2
== APP - job-service == Received job request...
== APP - job-service == Starting droid: R2-D2
== APP - job-service == Executing maintenance job: Oil Change
== APP - job-scheduler == Job Scheduled: C-3PO
== APP - job-scheduler == Job details: {"name":"C-3PO", "dueTime":"30s", "data":{"@type":"ttype.googleapis.com/google.protobuf.StringValue", "expression":"C-3PO:Limb Calibration"}}
== APP - job-scheduler-http == Job Scheduled: R2-D2
== APP - job-service-http == Received job request...
== APP - job-service-http == Starting droid: R2-D2
== APP - job-service-http == Executing maintenance job: Oil Change
== APP - job-scheduler-http == Job Scheduled: C-3PO
== APP - job-scheduler-http == Job details: {"name":"C-3PO", "dueTime":"30s", "data":{"@type":"ttype.googleapis.com/google.protobuf.StringValue", "expression":"C-3PO:Limb Calibration"}}
```
After 30 seconds, the terminal output should present the `C-3PO` job being processed:
```text
== APP - job-service == Received job request...
== APP - job-service == Starting droid: C-3PO
== APP - job-service == Executing maintenance job: Limb Calibration
== APP - job-service-http == Received job request...
== APP - job-service-http == Starting droid: C-3PO
== APP - job-service-http == Executing maintenance job: Limb Calibration
```
<!-- END_STEP -->
@ -83,7 +83,7 @@ dapr stop -f .
1. Open a terminal and run the `job-service` app:
```bash
dapr run --app-id job-service --app-port 6200 --dapr-http-port 6280 -- go run .
dapr run --app-id job-service-http --app-port 6200 --dapr-http-port 6280 -- go run .
```
2. On a new terminal window, schedule the `R2-D2` Job using the Jobs API.
@ -104,9 +104,9 @@ curl -X POST \
Back at the `job-service` app terminal window, the output should be:
```text
== APP - job-app == Received job request...
== APP - job-app == Starting droid: R2-D2
== APP - job-app == Executing maintenance job: Oil Change
== APP - job-service-http == Received job request...
== APP - job-service-http == Starting droid: R2-D2
== APP - job-service-http == Executing maintenance job: Oil Change
```
3. On the same terminal window, schedule the `C-3PO` Job using the Jobs API.
@ -155,5 +155,5 @@ curl -X GET http://localhost:6280/v1.0-alpha1/jobs/c-3po -H "Content-Type: appli
Back at the `job-service` app terminal window, the output should be:
```text
ERRO[0249] Error getting job c-3po due to: rpc error: code = Unknown desc = job not found: app||default||job-service||c-3po instance=diagrid.local scope=dapr.api type=log ver=1.14.0-rc.2
ERRO[0249] Error getting job c-3po due to: rpc error: code = Unknown desc = job not found: app||default||job-service-http||c-3po instance=diagrid.local scope=dapr.api type=log ver=1.14.0-rc.2
```

View File

@ -1,13 +1,12 @@
version: 1
apps:
- appDirPath: ./job-service/
appID: job-service
- appID: job-service-http
appDirPath: ./job-service/
appPort: 6200
daprHTTPPort: 6280
schedulerHostAddress: localhost
command: ["go", "run", "."]
- appDirPath: ./job-scheduler/
appID: job-scheduler
- appID: job-scheduler-http
appDirPath: ./job-scheduler/
appPort: 6300
daprHTTPPort: 6380
command: ["go", "run", "."]

View File

@ -20,10 +20,10 @@ Open a new terminal window and run the multi app run template:
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- '== APP - job-service == Starting droid: R2-D2'
- '== APP - job-service == Executing maintenance job: Oil Change'
- '== APP - job-service == Starting droid: C-3PO'
- '== APP - job-service == Executing maintenance job: Memory Wipe'
- '== APP - job-service-sdk == Starting droid: R2-D2'
- '== APP - job-service-sdk == Executing maintenance job: Oil Change'
- '== APP - job-service-sdk == Starting droid: C-3PO'
- '== APP - job-service-sdk == Executing maintenance job: Memory Wipe'
expected_stderr_lines:
output_match_mode: substring
match_order: none
@ -49,33 +49,33 @@ The terminal console output should look similar to this, where:
```text
== APP - job-service == dapr client initializing for: 127.0.0.1:6481
== APP - job-service == Registered job handler for: R2-D2
== APP - job-service == Registered job handler for: C-3PO
== APP - job-service == Registered job handler for: BB-8
== APP - job-service == Starting server on port: 6400
== APP - job-service == Job scheduled: R2-D2
== APP - job-service == Job scheduled: C-3PO
== APP - job-service == 2024/07/17 18:09:59 job:{name:"C-3PO" due_time:"10s" data:{value:"{\"droid\":\"C-3PO\",\"Task\":\"Memory Wipe\"}"}}
== APP - job-scheduler == Get job response: {"droid":"C-3PO","Task":"Memory Wipe"}
== APP - job-service == Job scheduled: BB-8
== APP - job-service == 2024/07/17 18:09:59 job:{name:"BB-8" due_time:"15s" data:{value:"{\"droid\":\"BB-8\",\"Task\":\"Internal Gyroscope Check\"}"}}
== APP - job-scheduler == Get job response: {"droid":"BB-8","Task":"Internal Gyroscope Check"}
== APP - job-scheduler == Deleted job: BB-8
== APP - job-service-sdk == dapr client initializing for: 127.0.0.1:6481
== APP - job-service-sdk == Registered job handler for: R2-D2
== APP - job-service-sdk == Registered job handler for: C-3PO
== APP - job-service-sdk == Registered job handler for: BB-8
== APP - job-service-sdk == Starting server on port: 6400
== APP - job-service-sdk == Job scheduled: R2-D2
== APP - job-service-sdk == Job scheduled: C-3PO
== APP - job-service-sdk == 2024/07/17 18:09:59 job:{name:"C-3PO" due_time:"10s" data:{value:"{\"droid\":\"C-3PO\",\"Task\":\"Memory Wipe\"}"}}
== APP - job-scheduler-sdk == Get job response: {"droid":"C-3PO","Task":"Memory Wipe"}
== APP - job-service-sdk == Job scheduled: BB-8
== APP - job-service-sdk == 2024/07/17 18:09:59 job:{name:"BB-8" due_time:"15s" data:{value:"{\"droid\":\"BB-8\",\"Task\":\"Internal Gyroscope Check\"}"}}
== APP - job-scheduler-sdk == Get job response: {"droid":"BB-8","Task":"Internal Gyroscope Check"}
== APP - job-scheduler-sdk == Deleted job: BB-8
```
After 5 seconds, the terminal output should present the `R2-D2` job being processed:
```text
== APP - job-service == Starting droid: R2-D2
== APP - job-service == Executing maintenance job: Oil Change
== APP - job-service-sdk == Starting droid: R2-D2
== APP - job-service-sdk == Executing maintenance job: Oil Change
```
After 10 seconds, the terminal output should present the `C3-PO` job being processed:
```text
== APP - job-service == Starting droid: C-3PO
== APP - job-service == Executing maintenance job: Memory Wipe
== APP - job-service-sdk == Starting droid: C-3PO
== APP - job-service-sdk == Executing maintenance job: Memory Wipe
```
<!-- END_STEP -->
@ -99,7 +99,7 @@ dapr stop -f .
1. Open a terminal and run the `job-service` app:
```bash
dapr run --app-id job-service --app-port 6400 --dapr-grpc-port 6481 --app-protocol grpc -- go run .
dapr run --app-id job-service-sdk --app-port 6400 --dapr-grpc-port 6481 --app-protocol grpc -- go run .
```
The output should be:
@ -115,7 +115,7 @@ The output should be:
2. On a new terminal window, run the `job-scheduler` app:
```bash
dapr run --app-id job-scheduler --app-port 6500 -- go run .
dapr run --app-id job-scheduler-sdk --app-port 6500 -- go run .
```
The output should be:

View File

@ -3,14 +3,13 @@ common:
daprdLogDestination: console
logLevel: info
apps:
- appDirPath: ./job-service/
appID: job-service
- appID: job-service-sdk
appDirPath: ./job-service/
appPort: 6400
daprGRPCPort: 6481
appProtocol: grpc
schedulerHostAddress: localhost
command: ["go", "run", "."]
- appDirPath: ./job-scheduler/
appID: job-scheduler
- appID: job-scheduler-sdk
appDirPath: ./job-scheduler/
appPort: 6500
command: ["go", "run", "."]

View File

@ -112,7 +112,7 @@ func schedule(droidJob DroidJob) error {
}
// Schedule Job
_, err = app.daprClient.InvokeMethodWithContent(context.Background(), "job-service", "scheduleJob", "POST", content)
_, err = app.daprClient.InvokeMethodWithContent(context.Background(), "job-service-sdk", "scheduleJob", "POST", content)
if err != nil {
fmt.Println("Error invoking method: ", err)
return err

View File

@ -23,7 +23,7 @@ This section shows how to run both applications at once using [multi-app run tem
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor"'
- 'Started Dapr with app id "order-processor-sdk"'
- 'Started Dapr with app id "checkout-sdk"'
- 'Published data: Order { OrderId = 2 }'
- 'Subscriber received : Order { OrderId = 2 }'
@ -43,25 +43,25 @@ 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 - order-processor-sdk == Subscriber received : Order { OrderId = 1 }
== APP - checkout-sdk == Published data: Order { OrderId = 2 }
== APP - order-processor == Subscriber received : Order { OrderId = 2 }
== APP - order-processor-sdk == Subscriber received : Order { OrderId = 2 }
== APP - checkout-sdk == Published data: Order { OrderId = 3 }
== APP - order-processor == Subscriber received : Order { OrderId = 3 }
== APP - order-processor-sdk == Subscriber received : Order { OrderId = 3 }
== APP - checkout-sdk == Published data: Order { OrderId = 4 }
== APP - order-processor == Subscriber received : Order { OrderId = 4 }
== APP - order-processor-sdk == Subscriber received : Order { OrderId = 4 }
== APP - checkout-sdk == Published data: Order { OrderId = 5 }
== APP - order-processor == Subscriber received : Order { OrderId = 5 }
== APP - order-processor-sdk == Subscriber received : Order { OrderId = 5 }
== APP - checkout-sdk == Published data: Order { OrderId = 6 }
== APP - order-processor == Subscriber received : Order { OrderId = 6 }
== APP - order-processor-sdk == Subscriber received : Order { OrderId = 6 }
== APP - checkout-sdk == Published data: Order { OrderId = 7 }
== APP - order-processor == Subscriber received : Order { OrderId = 7 }
== APP - order-processor-sdk == Subscriber received : Order { OrderId = 7 }
== APP - checkout-sdk == Published data: Order { OrderId = 8 }
== APP - order-processor == Subscriber received : Order { OrderId = 8 }
== APP - order-processor-sdk == Subscriber received : Order { OrderId = 8 }
== APP - checkout-sdk == Published data: Order { OrderId = 9 }
== APP - order-processor == Subscriber received : Order { OrderId = 9 }
== APP - order-processor-sdk == Subscriber received : Order { OrderId = 9 }
== APP - checkout-sdk == Published data: Order { OrderId = 10 }
== APP - order-processor == Subscriber received : Order { OrderId = 10 }
== APP - order-processor-sdk == Subscriber received : Order { OrderId = 10 }
```
2. Stop and clean up application processes
@ -81,7 +81,7 @@ An alternative to running all or multiple applications at once is to run single
```bash
cd ./order-processor
dapr run --app-id order-processor --resources-path ../../../components/ --app-port 7006 -- dotnet run
dapr run --app-id order-processor-sdk --resources-path ../../../components/ --app-port 7006 -- dotnet run
```
### Run Dotnet message publisher with Dapr
@ -97,6 +97,6 @@ dapr run --app-id checkout-sdk --resources-path ../../../components/ -- dotnet r
2. Stop and clean up application processes
```bash
dapr stop --app-id order-processor
dapr stop --app-id order-processor-sdk
dapr stop --app-id checkout-sdk
```

View File

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

View File

@ -19,10 +19,10 @@ This section shows how to run both applications at once using [multi-app run tem
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor"'
- 'Started Dapr with app id "order-processor-sdk"'
- 'Started Dapr with app id "checkout-sdk"'
- '== APP - checkout-sdk == Published data: {"orderId":1}'
- '== APP - order-processor == Subscriber received: map[orderId:1]'
- '== APP - order-processor-sdk == Subscriber received: map[orderId:1]'
expected_stderr_lines:
output_match_mode: substring
match_order: none
@ -39,25 +39,25 @@ 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 - order-processor-sdk == Subscriber received: map[orderId:1]
== APP - checkout-sdk == Published data: {"orderId":2}
== APP - order-processor == Subscriber received: map[orderId:2]
== APP - order-processor-sdk == Subscriber received: map[orderId:2]
== APP - checkout-sdk == Published data: {"orderId":3}
== APP - order-processor == Subscriber received: map[orderId:3]
== APP - order-processor-sdk == Subscriber received: map[orderId:3]
== APP - checkout-sdk == Published data: {"orderId":4}
== APP - order-processor == Subscriber received: map[orderId:4]
== APP - order-processor-sdk == Subscriber received: map[orderId:4]
== APP - checkout-sdk == Published data: {"orderId":5}
== APP - order-processor == Subscriber received: map[orderId:5]
== APP - order-processor-sdk == Subscriber received: map[orderId:5]
== APP - checkout-sdk == Published data: {"orderId":6}
== APP - order-processor == Subscriber received: map[orderId:6]
== APP - order-processor-sdk == Subscriber received: map[orderId:6]
== APP - checkout-sdk == Published data: {"orderId":7}
== APP - order-processor == Subscriber received: map[orderId:7]
== APP - order-processor-sdk == Subscriber received: map[orderId:7]
== APP - checkout-sdk == Published data: {"orderId":8}
== APP - order-processor == Subscriber received: map[orderId:8]
== APP - order-processor-sdk == Subscriber received: map[orderId:8]
== APP - checkout-sdk == Published data: {"orderId":9}
== APP - order-processor == Subscriber received: map[orderId:9]
== APP - order-processor-sdk == Subscriber received: map[orderId:9]
== APP - checkout-sdk == Published data: {"orderId":10}
== APP - order-processor == Subscriber received: map[orderId:10]
== APP - order-processor-sdk == Subscriber received: map[orderId:10]
```
<!-- END_STEP -->

View File

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

View File

@ -39,10 +39,10 @@ cd ..
<!-- STEP
name: Run multi app run template
expected_stdout_lines:
- 'Started Dapr with app id "order-processor"'
- 'Started Dapr with app id "order-processor-sdk"'
- 'Started Dapr with app id "checkout-sdk"'
- '== APP - checkout-sdk == Published data: {"orderId":1}'
- '== APP - order-processor == Subscriber received: {"orderId":1}'
- '== APP - order-processor-sdk == Subscriber received: {"orderId":1}'
expected_stderr_lines:
output_match_mode: substring
match_order: none
@ -59,25 +59,25 @@ 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 - order-processor-sdk == Subscriber received: {"orderId":1}
== APP - checkout-sdk == Published data: {"orderId":2}
== APP - order-processor == Subscriber received: {"orderId":2}
== APP - order-processor-sdk == Subscriber received: {"orderId":2}
== APP - checkout-sdk == Published data: {"orderId":3}
== APP - order-processor == Subscriber received: {"orderId":3}
== APP - order-processor-sdk == Subscriber received: {"orderId":3}
== APP - checkout-sdk == Published data: {"orderId":4}
== APP - order-processor == Subscriber received: {"orderId":4}
== APP - order-processor-sdk == Subscriber received: {"orderId":4}
== APP - checkout-sdk == Published data: {"orderId":5}
== APP - order-processor == Subscriber received: {"orderId":5}
== APP - order-processor-sdk == Subscriber received: {"orderId":5}
== APP - checkout-sdk == Published data: {"orderId":6}
== APP - order-processor == Subscriber received: {"orderId":6}
== APP - order-processor-sdk == Subscriber received: {"orderId":6}
== APP - checkout-sdk == Published data: {"orderId":7}
== APP - order-processor == Subscriber received: {"orderId":7}
== APP - order-processor-sdk == Subscriber received: {"orderId":7}
== APP - checkout-sdk == Published data: {"orderId":8}
== APP - order-processor == Subscriber received: {"orderId":8}
== APP - order-processor-sdk == Subscriber received: {"orderId":8}
== APP - checkout-sdk == Published data: {"orderId":9}
== APP - order-processor == Subscriber received: {"orderId":9}
== APP - order-processor-sdk == Subscriber received: {"orderId":9}
== APP - checkout-sdk == Published data: {"orderId":10}
== APP - order-processor == Subscriber received: {"orderId":10}
== APP - order-processor-sdk == Subscriber received: {"orderId":10}
```
3. Stop and clean up application processes

View File

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

View File

@ -1,7 +1,7 @@
version: 1
apps:
- appDirPath: ./order-processor/
appID: order-processor
- appID: order-processor
appDirPath: ./order-processor/
appPort: 7001
command: ["dotnet", "run"]
- appID: checkout

View File

@ -1,7 +1,7 @@
version: 1
apps:
- appDirPath: ./order-processor/
appID: order-processor
- appID: order-processor
appDirPath: ./order-processor/
appPort: 6006
command: ["go", "run", "."]
- appID: checkout

View File

@ -1,7 +1,7 @@
version: 1
apps:
- appDirPath: ./order-processor/
appID: order-processor
- appID: order-processor
appDirPath: ./order-processor/
appPort: 9001
command: ["java", "-jar", "target/OrderProcessingService-0.0.1-SNAPSHOT.jar"]
- appID: checkout

View File

@ -1,7 +1,7 @@
version: 1
apps:
- appDirPath: ./order-processor/
appID: order-processor
- appID: order-processor
appDirPath: ./order-processor/
appPort: 5001
command: ["npm", "start"]
- appID: checkout

View File

@ -1,7 +1,7 @@
version: 1
apps:
- appDirPath: ./order-processor/
appID: order-processor
- appID: order-processor
appDirPath: ./order-processor/
appPort: 8001
command: ["python3", "app.py"]
- appID: checkout

View File

@ -2,7 +2,7 @@ version: 1
common:
resourcesPath: ../../components
apps:
- appDirPath: ./order-processor/
appID: order-processor
- appID: order-processor
appDirPath: ./order-processor/
command: ["go", "run", "."]

View File

@ -34,8 +34,8 @@ cd ..
<!-- STEP
name: Run order-processor service
expected_stdout_lines:
- '== APP - WorkflowConsoleApp == there are now 90 cars left in stock'
- '== APP - WorkflowConsoleApp == workflow instance completed, out is: {"processed":true}'
- '== APP - order-processor == there are now 90 cars left in stock'
- '== APP - order-processor == workflow instance completed, out is: {"processed":true}'
expected_stderr_lines:
output_match_mode: substring
background: true
@ -53,32 +53,32 @@ dapr run -f .
```
== APP - WorkflowConsoleApp == *** Welcome to the Dapr Workflow console app sample!
== APP - WorkflowConsoleApp == *** Using this app, you can place orders that start workflows.
== APP - WorkflowConsoleApp == Start workflow runtime
== APP - WorkflowConsoleApp == Oct 06, 2023 3:10:01 PM com.microsoft.durabletask.DurableTaskGrpcWorker startAndBlock
== APP - WorkflowConsoleApp == INFO: Durable Task worker is connecting to sidecar at 127.0.0.1:50001.
== APP - WorkflowConsoleApp == ==========Begin the purchase of item:==========
== APP - WorkflowConsoleApp == Starting order workflow, purchasing 10 of cars
== APP - WorkflowConsoleApp == scheduled new workflow instance of OrderProcessingWorkflow with instance ID: 397faa44-1374-4f9d-a7fe-c74160604064
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.workflows.WorkflowContext - Starting Workflow: io.dapr.quickstarts.workflows.OrderProcessingWorkflow
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.workflows.WorkflowContext - Instance ID(order ID): 397faa44-1374-4f9d-a7fe-c74160604064
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.workflows.WorkflowContext - Current Orchestration Time: 2023-10-06T22:10:04.769Z
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.workflows.WorkflowContext - Received Order: OrderPayload [itemName=cars, totalCost=150000, quantity=10]
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.NotifyActivity - Received Order: OrderPayload [itemName=cars, totalCost=150000, quantity=10]
== APP - WorkflowConsoleApp == workflow instance 397faa44-1374-4f9d-a7fe-c74160604064 started
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.ReserveInventoryActivity - Reserving inventory for order '397faa44-1374-4f9d-a7fe-c74160604064' of 10 cars
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.ReserveInventoryActivity - There are 100 cars available for purchase
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.ReserveInventoryActivity - Reserved inventory for order '397faa44-1374-4f9d-a7fe-c74160604064' of 10 cars
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.RequestApprovalActivity - Requesting approval for order: OrderPayload [itemName=cars, totalCost=150000, quantity=10]
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.RequestApprovalActivity - Approved requesting approval for order: OrderPayload [itemName=cars, totalCost=150000, quantity=10]
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.ProcessPaymentActivity - Processing payment: 397faa44-1374-4f9d-a7fe-c74160604064 for 10 cars at $150000
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.ProcessPaymentActivity - Payment for request ID '397faa44-1374-4f9d-a7fe-c74160604064' processed successfully
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.UpdateInventoryActivity - Updating inventory for order '397faa44-1374-4f9d-a7fe-c74160604064' of 10 cars
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.UpdateInventoryActivity - Updated inventory for order '397faa44-1374-4f9d-a7fe-c74160604064': there are now 90 cars left in stock
== APP - WorkflowConsoleApp == there are now 90 cars left in stock
== APP - WorkflowConsoleApp == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.NotifyActivity - Order completed! : 397faa44-1374-4f9d-a7fe-c74160604064
== APP - WorkflowConsoleApp == workflow instance completed, out is: {"processed":true}
== APP - order-processor == *** Welcome to the Dapr Workflow console app sample!
== APP - order-processor == *** Using this app, you can place orders that start workflows.
== APP - order-processor == Start workflow runtime
== APP - order-processor == Oct 06, 2023 3:10:01 PM com.microsoft.durabletask.DurableTaskGrpcWorker startAndBlock
== APP - order-processor == INFO: Durable Task worker is connecting to sidecar at 127.0.0.1:50001.
== APP - order-processor == ==========Begin the purchase of item:==========
== APP - order-processor == Starting order workflow, purchasing 10 of cars
== APP - order-processor == scheduled new workflow instance of OrderProcessingWorkflow with instance ID: 397faa44-1374-4f9d-a7fe-c74160604064
== APP - order-processor == [Thread-0] INFO io.dapr.workflows.WorkflowContext - Starting Workflow: io.dapr.quickstarts.workflows.OrderProcessingWorkflow
== APP - order-processor == [Thread-0] INFO io.dapr.workflows.WorkflowContext - Instance ID(order ID): 397faa44-1374-4f9d-a7fe-c74160604064
== APP - order-processor == [Thread-0] INFO io.dapr.workflows.WorkflowContext - Current Orchestration Time: 2023-10-06T22:10:04.769Z
== APP - order-processor == [Thread-0] INFO io.dapr.workflows.WorkflowContext - Received Order: OrderPayload [itemName=cars, totalCost=150000, quantity=10]
== APP - order-processor == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.NotifyActivity - Received Order: OrderPayload [itemName=cars, totalCost=150000, quantity=10]
== APP - order-processor == workflow instance 397faa44-1374-4f9d-a7fe-c74160604064 started
== APP - order-processor == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.ReserveInventoryActivity - Reserving inventory for order '397faa44-1374-4f9d-a7fe-c74160604064' of 10 cars
== APP - order-processor == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.ReserveInventoryActivity - There are 100 cars available for purchase
== APP - order-processor == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.ReserveInventoryActivity - Reserved inventory for order '397faa44-1374-4f9d-a7fe-c74160604064' of 10 cars
== APP - order-processor == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.RequestApprovalActivity - Requesting approval for order: OrderPayload [itemName=cars, totalCost=150000, quantity=10]
== APP - order-processor == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.RequestApprovalActivity - Approved requesting approval for order: OrderPayload [itemName=cars, totalCost=150000, quantity=10]
== APP - order-processor == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.ProcessPaymentActivity - Processing payment: 397faa44-1374-4f9d-a7fe-c74160604064 for 10 cars at $150000
== APP - order-processor == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.ProcessPaymentActivity - Payment for request ID '397faa44-1374-4f9d-a7fe-c74160604064' processed successfully
== APP - order-processor == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.UpdateInventoryActivity - Updating inventory for order '397faa44-1374-4f9d-a7fe-c74160604064' of 10 cars
== APP - order-processor == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.UpdateInventoryActivity - Updated inventory for order '397faa44-1374-4f9d-a7fe-c74160604064': there are now 90 cars left in stock
== APP - order-processor == there are now 90 cars left in stock
== APP - order-processor == [Thread-0] INFO io.dapr.quickstarts.workflows.activities.NotifyActivity - Order completed! : 397faa44-1374-4f9d-a7fe-c74160604064
== APP - order-processor == workflow instance completed, out is: {"processed":true}
```
### View workflow output with Zipkin
@ -97,7 +97,7 @@ docker run -d -p 9411:9411 openzipkin/zipkin
### What happened?
When you ran `dapr run --app-id WorkflowConsoleApp --resources-path ../../../components/ --dapr-grpc-port 50001 -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar io.dapr.quickstarts.workflows.WorkflowConsoleApp`
When you ran `dapr run --app-id order-processor --resources-path ../../../components/ --dapr-grpc-port 50001 -- java -jar target/OrderProcessingService-0.0.1-SNAPSHOT.jar io.dapr.quickstarts.workflows.WorkflowConsoleApp`
1. A unique order ID for the workflow is generated (in the above example, `95d33f7c-3af8-4960-ba11-4ecea83b0509`) and the workflow is scheduled.
2. The `NotifyActivity` workflow activity sends a notification saying an order for 10 cars has been received.

View File

@ -2,6 +2,6 @@ version: 1
common:
resourcesPath: ../../components
apps:
- appID: WorkflowConsoleApp
- appID: order-processor
appDirPath: ./order-processor/target
command: ["java", "-jar", "OrderProcessingService-0.0.1-SNAPSHOT.jar", "io.dapr.quickstarts.workflows.WorkflowConsoleApp"]

View File

@ -37,7 +37,7 @@ npm run build
<!-- STEP
name: Run order-processor service
expected_stdout_lines:
- '== APP - workflowApp == Payment of 100 for 10 item1 processed successfully'
- '== APP - order-processor == Payment of 100 for 10 item1 processed successfully'
- 'there are now 90 item1 in stock'
- 'processed successfully!'
expected_stderr_lines:
@ -60,7 +60,7 @@ dapr run -f dapr-AppWithExpressServer.yaml
```bash
curl --request POST \
--url http://localhost:3500/v1.0/invoke/workflowApp/method/start-workflow
--url http://localhost:3500/v1.0/invoke/order-processor/method/start-workflow
```
- Entry point 3 : Express app via Dapr Server
@ -70,73 +70,73 @@ dapr run -f dapr-AppWithDaprServer.yaml
```
```bash
curl --request POST \
--url http://localhost:3500/v1.0/invoke/workflowApp/method/start-workflow
--url http://localhost:3500/v1.0/invoke/order-processor/method/start-workflow
```
3. Expected output
```
== APP - workflowApp == == APP == Orchestration scheduled with ID: 0c332155-1e02-453a-a333-28cfc7777642
== APP - workflowApp == == APP == Waiting 30 seconds for instance 0c332155-1e02-453a-a333-28cfc7777642 to complete...
== APP - workflowApp == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 0 history event...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, EXECUTIONSTARTED=1]
== APP - workflowApp == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Waiting for 1 task(s) and 0 event(s) to complete...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - workflowApp == == APP == Received "Activity Request" work item
== APP - workflowApp == == APP == Received order 0c332155-1e02-453a-a333-28cfc7777642 for 10 item1 at a total cost of 100
== APP - workflowApp == == APP == Activity notifyActivity completed with output undefined (0 chars)
== APP - workflowApp == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 3 history event...
== APP - workflowApp == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, TASKCOMPLETED=1]
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Waiting for 1 task(s) and 0 event(s) to complete...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - workflowApp == == APP == Received "Activity Request" work item
== APP - workflowApp == == APP == Reserving inventory for 0c332155-1e02-453a-a333-28cfc7777642 of 10 item1
== APP - workflowApp == == APP == 2024-02-16T03:15:59.498Z INFO [HTTPClient, HTTPClient] Sidecar Started
== APP - workflowApp == == APP == There are 100 item1 in stock
== APP - workflowApp == == APP == Activity reserveInventoryActivity completed with output {"success":true,"inventoryItem":{"perItemCost":100,"quantity":100,"itemName":"item1"}} (86 chars)
== APP - workflowApp == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 6 history event...
== APP - workflowApp == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, TASKCOMPLETED=1]
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Waiting for 1 task(s) and 0 event(s) to complete...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - workflowApp == == APP == Received "Activity Request" work item
== APP - workflowApp == == APP == Processing payment for order item1
== APP - workflowApp == == APP == Payment of 100 for 10 item1 processed successfully
== APP - workflowApp == == APP == Activity processPaymentActivity completed with output true (4 chars)
== APP - workflowApp == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 9 history event...
== APP - workflowApp == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, TASKCOMPLETED=1]
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Waiting for 1 task(s) and 0 event(s) to complete...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - workflowApp == == APP == Received "Activity Request" work item
== APP - workflowApp == == APP == Updating inventory for 0c332155-1e02-453a-a333-28cfc7777642 of 10 item1
== APP - workflowApp == == APP == Inventory updated for 0c332155-1e02-453a-a333-28cfc7777642, there are now 90 item1 in stock
== APP - workflowApp == == APP == Activity updateInventoryActivity completed with output {"success":true,"inventoryItem":{"perItemCost":100,"quantity":90,"itemName":"item1"}} (85 chars)
== APP - workflowApp == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 12 history event...
== APP - workflowApp == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, TASKCOMPLETED=1]
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Waiting for 1 task(s) and 0 event(s) to complete...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - workflowApp == == APP == Received "Activity Request" work item
== APP - workflowApp == == APP == order 0c332155-1e02-453a-a333-28cfc7777642 processed successfully!
== APP - workflowApp == == APP == Activity notifyActivity completed with output undefined (0 chars)
== APP - workflowApp == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 15 history event...
== APP - workflowApp == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, TASKCOMPLETED=1]
== APP - workflowApp == == APP == Order 0c332155-1e02-453a-a333-28cfc7777642 processed successfully!
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Orchestration completed with status COMPLETED
== APP - workflowApp == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - workflowApp == time="2024-02-15T21:15:59.5589687-06:00" level=info msg="0c332155-1e02-453a-a333-28cfc7777642: 'orderProcessingWorkflow' completed with a COMPLETED status." app_id=activity-sequence-workflow instance=kaibocai-devbox scope=wfengine.backend type=log ver=1.12.4
== APP - workflowApp == == APP == Instance 0c332155-1e02-453a-a333-28cfc7777642 completed
== APP - order-processor == == APP == Orchestration scheduled with ID: 0c332155-1e02-453a-a333-28cfc7777642
== APP - order-processor == == APP == Waiting 30 seconds for instance 0c332155-1e02-453a-a333-28cfc7777642 to complete...
== APP - order-processor == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 0 history event...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, EXECUTIONSTARTED=1]
== APP - order-processor == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Waiting for 1 task(s) and 0 event(s) to complete...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - order-processor == == APP == Received "Activity Request" work item
== APP - order-processor == == APP == Received order 0c332155-1e02-453a-a333-28cfc7777642 for 10 item1 at a total cost of 100
== APP - order-processor == == APP == Activity notifyActivity completed with output undefined (0 chars)
== APP - order-processor == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 3 history event...
== APP - order-processor == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, TASKCOMPLETED=1]
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Waiting for 1 task(s) and 0 event(s) to complete...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - order-processor == == APP == Received "Activity Request" work item
== APP - order-processor == == APP == Reserving inventory for 0c332155-1e02-453a-a333-28cfc7777642 of 10 item1
== APP - order-processor == == APP == 2024-02-16T03:15:59.498Z INFO [HTTPClient, HTTPClient] Sidecar Started
== APP - order-processor == == APP == There are 100 item1 in stock
== APP - order-processor == == APP == Activity reserveInventoryActivity completed with output {"success":true,"inventoryItem":{"perItemCost":100,"quantity":100,"itemName":"item1"}} (86 chars)
== APP - order-processor == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 6 history event...
== APP - order-processor == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, TASKCOMPLETED=1]
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Waiting for 1 task(s) and 0 event(s) to complete...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - order-processor == == APP == Received "Activity Request" work item
== APP - order-processor == == APP == Processing payment for order item1
== APP - order-processor == == APP == Payment of 100 for 10 item1 processed successfully
== APP - order-processor == == APP == Activity processPaymentActivity completed with output true (4 chars)
== APP - order-processor == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 9 history event...
== APP - order-processor == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, TASKCOMPLETED=1]
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Waiting for 1 task(s) and 0 event(s) to complete...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - order-processor == == APP == Received "Activity Request" work item
== APP - order-processor == == APP == Updating inventory for 0c332155-1e02-453a-a333-28cfc7777642 of 10 item1
== APP - order-processor == == APP == Inventory updated for 0c332155-1e02-453a-a333-28cfc7777642, there are now 90 item1 in stock
== APP - order-processor == == APP == Activity updateInventoryActivity completed with output {"success":true,"inventoryItem":{"perItemCost":100,"quantity":90,"itemName":"item1"}} (85 chars)
== APP - order-processor == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 12 history event...
== APP - order-processor == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, TASKCOMPLETED=1]
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Waiting for 1 task(s) and 0 event(s) to complete...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - order-processor == == APP == Received "Activity Request" work item
== APP - order-processor == == APP == order 0c332155-1e02-453a-a333-28cfc7777642 processed successfully!
== APP - order-processor == == APP == Activity notifyActivity completed with output undefined (0 chars)
== APP - order-processor == == APP == Received "Orchestrator Request" work item with instance id '0c332155-1e02-453a-a333-28cfc7777642'
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Rebuilding local state with 15 history event...
== APP - order-processor == == APP == Processing order 0c332155-1e02-453a-a333-28cfc7777642...
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Processing 2 new history event(s): [ORCHESTRATORSTARTED=1, TASKCOMPLETED=1]
== APP - order-processor == == APP == Order 0c332155-1e02-453a-a333-28cfc7777642 processed successfully!
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Orchestration completed with status COMPLETED
== APP - order-processor == == APP == 0c332155-1e02-453a-a333-28cfc7777642: Returning 1 action(s)
== APP - order-processor == time="2024-02-15T21:15:59.5589687-06:00" level=info msg="0c332155-1e02-453a-a333-28cfc7777642: 'orderProcessingWorkflow' completed with a COMPLETED status." app_id=activity-sequence-workflow instance=kaibocai-devbox scope=wfengine.backend type=log ver=1.12.4
== APP - order-processor == == APP == Instance 0c332155-1e02-453a-a333-28cfc7777642 completed
```
### View workflow output with Zipkin

View File

@ -2,7 +2,7 @@ version: 1
common:
resourcesPath: ../../components
apps:
- appID: workflowApp
- appID: order-processor
appDirPath: ./order-processor/
appPort: 3000
daprHTTPPort: 3500

View File

@ -2,7 +2,7 @@ version: 1
common:
resourcesPath: ../../components
apps:
- appID: workflowApp
- appID: order-processor
appDirPath: ./order-processor/
appPort: 3000
daprHTTPPort: 3500

View File

@ -2,6 +2,6 @@ version: 1
common:
resourcesPath: ../../components
apps:
- appID: workflowApp
- appID: order-processor
appDirPath: ./order-processor/
command: ["npm", "run", "start:order-process"]

View File

@ -2,6 +2,6 @@ version: 1
common:
resourcesPath: ../../components
apps:
- appDirPath: ./order-processor/
appID: order-processor
- appID: order-processor
appDirPath: ./order-processor/
command: ["python3", "app.py"]