quickstarts/service_invocation/java/http
Paul Yuknewicz dcd97eeeeb
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>
2023-09-22 10:02:07 -07:00
..
checkout Add Resiliency Quickstarts for Service Invoke and State Management (#744) 2022-11-16 14:57:45 -08:00
order-processor 701: Java quickstarts cleanup: 2022-07-08 12:35:43 +01:00
README.md Updating Readme's to default to `dapr run -f .` (#874) 2023-09-22 10:02:07 -07:00
dapr.yaml Pinning dapr version and fixes validations. 2023-02-07 14:48:40 -08:00
makefile Removed docker image prefix addition step 2022-07-25 12:28:57 -07:00

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:

  • Java client service checkout

And one order processor service:

  • Java order-processor service order-processor

Pre-requisites

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.

  1. Open a new terminal window and install dependencies for order-processor and checkout apps:
cd ./order-processor
mvn clean install
cd ../checkout
mvn clean install
cd ..
  1. Run the multi app run template:
dapr run -f .

The terminal console output should look similar to this:

== 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
  1. 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 .. -- 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:
cd ./order-processor
mvn clean install
  1. Run the Java order-processor app with Dapr:
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:
cd ./checkout
mvn clean install
  1. Run the Java checkout app with Dapr:
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

dapr stop --app-id checkout
dapr stop --app-id order-processor