The following scenario is implemented here.
A client wants to have some information about the weather, the time and some news. He retrieves these information via the dashboard service. The dashboard service collects all these single information from three separate services. But not by calling the services directly. Instead, the dashboard service requests its own dapr sidecar to collect the information from the other services providing their service names and endpoint methods. The sidecar then requests the information from the other services sidecars. This is where the dapr service invocation comes into play.
- dapr CLI
- Java (Version >=17)
./gradlew buildAllServicesdapr run --app-id dashboard-service --app-port 8080 --app-protocol http --dapr-http-port 3500 -- java -cp dashboard/build/libs/fat.jar com.example.DashboardKtdapr run --app-id weather-service --app-port 8081 --app-protocol http --dapr-http-port 3501 -- java -cp weather/build/libs/fat.jar com.example.WeatherKtdapr run --app-id time-service --app-port 8082 --app-protocol http --dapr-http-port 3502 -- java -cp time/build/libs/fat.jar com.example.TimeKtdapr run --app-id news-service --app-port 8083 --app-protocol http --dapr-http-port 3503 -- java -cp news/build/libs/fat.jar com.example.NewsKtAs you can see, the dapr CLI is used to start up both, the dapr sidecar and the service.
curl http://localhost:8080/dashboard