* 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> |
||
|---|---|---|
| .. | ||
| checkout | ||
| order-processor | ||
| README.md | ||
| dapr.yaml | ||
| makefile | ||
README.md
Service Invocation
In this quickstart, you'll create a checkout service and an order processor service to demonstrate how to use the service invocation API. The checkout service uses Dapr's http proxying capability to invoke a method on the order processing service.
Visit this link for more information about Dapr and service invocation.
This quickstart includes one checkout service:
- Python client service
checkout
And one order processor service:
- Python 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 with dapr run -f .. This enables to you test the interactions between multiple applications.
- Open a new terminal window and install dependencies for
order-processorandcheckoutapps:
cd ./order-processor
pip3 install -r requirements.txt
cd ../checkout
pip3 install -r requirements.txt
cd ..
- Run the multi app run template:
dapr run -f .
The terminal console output should look similar to this:
== 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}
- Stop and clean up application processes
dapr stop -f .
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
- Install dependencies for
order-processorapp:
cd ./order-processor
pip3 install -r requirements.txt
- Run the Python order-processor app with Dapr:
dapr run --app-port 8001 --app-id order-processor --app-protocol http --dapr-http-port 3501 -- python3 app.py
Run Python checkout with Dapr
- Open a new terminal window and install dependencies for
checkoutapp:
cd ./checkout
pip3 install -r requirements.txt
- Run the Python checkout app with Dapr:
dapr run --app-id checkout --app-protocol http --dapr-http-port 3500 -- python3 app.py
Stop and clean up application processes
dapr stop --app-id checkout
dapr stop --app-id order-processor